akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;


namespace StartFinish
{
    class Program
    {
        static double ManHattan(int[] xy)
        {
            double sum = 0;
            foreach(var x in xy)
            {
                sum += x;
            }
            return sum;
        }

        static double Yukurid(int[] xy)
        {
            double sum = 0;
            foreach(var x in xy)
            {
                sum += x * x;
            }
            return Math.Sqrt(sum);
        }

        static double three(int[] xy)
        {
            double sum = 0;
            foreach(var x in xy)
            {
                sum += x * x * x;
            }
            return Math.Pow(sum, 1.0 / 3.0);
        }
        static double Max(int[] xy)
        {
            double sum = 0;
            foreach(var x in xy)
            {
                if (sum < x)
                {
                    sum = x;
                }
            }
            return sum;
        }
        
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] x = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int[] y = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int[] xy = new int[n];
            for(int i = 0; i < n; i++)
            {
                xy[i] = Math.Abs(x[i] - y[i]);
            }
            Console.WriteLine(Program.ManHattan(xy));
            Console.WriteLine(Program.Yukurid(xy));
            Console.WriteLine(Program.three(xy));
            Console.WriteLine(Program.Max(xy));
        }
    }
}

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

int main() {
    string s, t;
    cin >> s >> t;
    int ss = s.size();
    int ts = t.size();
    if (ts != ss + 1) {
        cout << "No" << endl;
        return 0;
    }

    for (int i = 0; i < ss; i++) {
        if (s[i] != t[i]) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3616
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	L = int(input())
	ans = (L / 3) ** 3
	print(ans)


if __name__ == '__main__':
	main()

Measured memory_bytes: 38512
n = int(input())
check=0
for i in range(n):
    a,b=map(int,input().split())
    if(a==b):
        check+=1
    else:
        if(check>=3):
            print('Yes')
            exit()
        check=0
if check>=3:
    print('Yes')
    exit()
print('No')

Measured memory_bytes: 62352
#include <algorithm>
#include <deque>
#include <iostream>
#include <map>
#include <set>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
char alpha[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'};
int N;
int MEMO[10][10];

void search(string cur, int max_char) {
  if (cur.length() == N) {
    cout << cur << endl;
    return;
  }
  for (char c = 'a'; c <= max_char; c++) {
    char next_max = max_char;
    if (c == max_char) {
      next_max = (char)max_char + 1;
    }
    search(cur + c, next_max);
  }
}

int main() {
  cin >> N;
  search("", 'a');
  return 0;
}

Measured memory_bytes: 1536
import java.util.Scanner;


public class Main {

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

		while(true){
			int h = stdIn.nextInt();
			int w = stdIn.nextInt();

			if(h==0&&w==0){
				return;
			}

			int size = h*h+w*w;
			int xh = Integer.MAX_VALUE;
			int xw = Integer.MAX_VALUE;
			int bestSize = Integer.MAX_VALUE;
			for(int i=1;i<=150;i++){
				for(int j=i+1;j<=150;j++){
					if(i==h&&j==w) continue;
					int now = i*i+j*j;
					if(size<now&&bestSize>now){
						xh = i;
						xw = j;
						bestSize = now;
					}
					else if(size==now&&bestSize>now&&i>h){
						xh = i;
						xw = j;
						bestSize = now;
					}
				}
			}
			System.out.println(xh+" "+xw);
		}

	}

}

Measured memory_bytes: 20364
#include<iostream>
#include<cstdio>
using namespace std;
int n,m,k;
int nd1[21],nd2[21];
int go[1<<21][21];
int nxt[1<<21];
int dp[1<<21];
const int md=1e9+7;
int ans;
int main()
{
	scanf("%d%d%d",&n,&m,&k);
	for(int i=1;i<=k;i++)
	{
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		a--;b--;
		nd1[a]|=(1<<b);
		nd2[a]|=(1<<b)*c;
	}
	n--;
	for(int i=0;i<(1<<n);i++)
	{
		int id=0;
		for(int j=0;j<n;j++)
		{
			go[i][j]=-1;
			if(i>>j&1)
			{
				if(j && !(i>>(j-1)&1))
				{
					go[i][id]=i^(1<<j)^(1<<(j-1));
				}
				id++;
			}
		}
	}
	for(int i=0;i<(1<<n);i++)
	{
		for(int j=n-1;j>=0;j--)
		{
			if(i>>j&1)continue;
			nxt[i]=i|(1<<j);
			break;
		}
	}
	dp[0]=1;
	for(int l=0;l<m;l++)
	{
		for(int i=0;i<(1<<n)-1;i++)
		{
			dp[nxt[i]]+=dp[i];
			if(dp[nxt[i]]>=md)dp[nxt[i]]-=md;
		}
		for(int id=0;id<n;id++)
		{
			for(int i=(1<<n)-1;i>=0;i--)
			{
				if(go[i][id]==-1)continue;
				dp[go[i][id]]+=dp[i];
				if(dp[go[i][id]]>=md)dp[go[i][id]]-=md;
			}
		}
		for(int i=0;i<(1<<n);i++)
		{
			if((i&nd1[l])!=nd2[l])dp[i]=0;
		}
	}
	for(int i=0;i<(1<<n);i++)
	{
		ans+=dp[i];
		if(ans>=md)ans-=md; 
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 53504
import math
A, B, N = map(int,input().split(' '))

def f(x):
    return math.floor(A*x/B)-A*math.floor(x/B)


def main():
    if N >= B:
        print(f(B-1))
    else:
        print(f(N))

if __name__ == "__main__":
    main()


Measured memory_bytes: 9072
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

	int n;
	while(cin>>n&&n!=0){
		vector<int> nums;
		int t;
		for(int i = 0; i < n; i++){
			cin>>t;
			nums.push_back(t);
		}
		int s;
		cin>>s;
		int ub=n-1;
		int lb=0;
		int cnt=0;
		while(1){
			if(ub<lb)
				break;
			cnt++;
			int mid=ub+lb;
			mid/=2;
			if(nums[mid]==s||ub==lb){
				break;
			}
			else if(nums[mid]>s){
				ub=mid-1;
			}
			else if(nums[mid]<s){
				lb=mid+1;
			}
		}
		cout<<cnt<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;
template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
long long mod = 998244353;
#define REP(i, n) for (long long i = 0; i < (n); i++)

long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}

long long moddiv(long long a, long long b) { return (a * modpow(b, mod - 2)) % mod; }

long long nCkmod(long long n, long long k) {
    long long denomi = 1;
    REP(i, n) {
        denomi *= (i + 1);
        denomi %= mod;
    }
    long long numera = 1;
    for (int i = n - k; i > 0; i--) {
        numera *= i;
        numera %= mod;
    }
    REP(i, k) {
        numera *= (i + 1);
        numera %= mod;
    }
    return moddiv(denomi, numera);
}

void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}
signed main() {
    int n, x;
    cin >> n >> x;
    vector<int> as(n);
    REP(i, n) { cin >> as[i]; }
    sort(as.begin(), as.end());
    int happy = 0;
    REP(i, n - 1) {
        if (x >= as[i]) {
            happy++;
            x -= as[i];
        }
    }
    if (x == as[n - 1]) {
        happy++;
    }
    cout << happy << endl;
}

Measured memory_bytes: 256
<?php
list($h,$w)=explode(" ",trim(fgets(STDIN)));
$a = str_repeat("#",$w+2);
echo $a . PHP_EOL;

$i = 0;
while($i < $h){
echo "#";
echo trim(fgets(STDIN));
echo "#" . PHP_EOL;
++$i;
}
echo $a ;
?>


Measured memory_bytes: 3828
k = list(map(int, input().split()))
n = k[ 0 ]
m = k[ 1 ]

bigArray = []
smallArray = []
for i in range ( n ) :
    bigArray.append( list(map(int, input().split())) )
for i in range ( m ) :
    smallArray.append( int(input()) )

for i in range ( n ) :
    answerPerRow = 0
    for j in range ( m ) :
        answerPerRow += bigArray[ i ][ j ] * smallArray[ j ]
    print( answerPerRow )

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

#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); ++(i))
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); --(i))

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using int32 = int;
using int64 = long long;

const int   mod   = 1e9 + 7;
const int32 inf   = 1001001001;
const int64 infll = 1001001001001001001ll;

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

struct IoSetup { IoSetup(int x = 10){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = int64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; } 
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.first << " " << p.second; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }

template <typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void solver() {
  int N = input(), C = input();
  auto D = make_v(C, C, 0);
  cin >> D;

  auto c = make_v(N, N, 0);
  cin >> c;
  for (auto &s : c) for (auto &t : s) t--;

  auto v = make_v(3, C, 0);
  range(i, 0, N) range(j, 0, N) {
    v[(i + j) % 3][c[i][j]]++;
  }

  int ans = inf;
  range(i, 0, C) range(j, 0, C) range(k, 0, C) {
    if (i == j || j == k || k == i) continue;

    int sum = 0;
    range(x, 0, C) {
      sum += D[x][i] * v[0][x] +
             D[x][j] * v[1][x] + 
             D[x][k] * v[2][x];
    }

    chmin(ans, sum);
  }

  cout << ans << endl;
}

signed main(int argc, char *argv[]) {
  solver();
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
//#define f(i,a,n) for(ll i=a;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
 
int main() 
{
    fast;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        ll n,m;
        string s;
        cin>>s;
        n=s.size();
        for(ll i=0;i<n;i++)
        {
            if(s[i]!=s[n-i-1])
            {
                cout<<"No";
                exit(0);
            }
        }
        m=n/2;
        for(ll i=0;i<m;i++)
        {
            if(s[i]!=s[m-i-1])
            {
                cout<<"No";
                exit(0);
            }
        }
        cout<<"Yes";
        
    }
    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(x)    (x).begin(),(x).end()
typedef long long ll;
const int MOD = (int)1e9 + 7;

int main(){
  int m,d;
  cin >> m >> d;
  int count = 0;
  rep(i,m){
    int month = i+1;
    rep(j,d){
      int d1,d2;
      d1 = (j+1) / 10;
      d2 = (j+1) % 10;
      if(d1 < 2 || d2 < 2) continue;
      if(month == d1 * d2) count++;
    }
  }
  cout << count << endl;
}



Measured memory_bytes: 256
/*Arnab's Code
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define vll vector<ll>
#define vii vector<int>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define take(a,n) for(ll i=0;i<n;i++)cin>>a[i]
#define takes(a,n,st) for(ll i=st;i<n+st;i++)cin>>a[i]
ll sum(ll a[],ll n,ll s){ for(ll i=0;i<n;i++)s+=a[i]; return s;}
#define mod 1000000009
ll power(ll x, ll y, ll p)  {  
    ll res = 1;  
    x = x % p;   
    if (x == 0) return 0;  
    while (y > 0){  
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1;
        x = (x*x) % p;  
    }  
    return res;  
}
ll a[200017];
void solve(){
	ll n,k,i;
	cin>>n>>k;
	take(a,n);
	for(i=k;i<n;i++){
		if(a[i]>a[i-k])
			cout<<"Yes\n";
		else
			cout<<"No\n";
	}
	return;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	ll t,T;
//	cin>>T;
	T=1;
	for(t=1;t<=T;t++){
//		cout<<"Case #"<<t<<": ";
		solve();
	}
	return 0;
}

Measured memory_bytes: 5216
#include <algorithm>
#include <map>
#include <iostream>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <iterator>
#include <array>
typedef long long int ll;
using namespace std;
#define maxN 1000005
#define mod 1000000007

ll all[maxN]= {};
int s;

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

void solve() {
	int ans=0;
	for(int i=1; i<=s; i++) {
		for(int j=1; j<=s; j++) {
			for(int k=1; k<=s; k++) {
				int temp = i;
				temp = gcd(temp,j);
				temp = gcd(temp,k);
				ans+=temp;
			}
		}
	}
	cout<<ans<<endl;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>s;
	solve();
}

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

int N;
int l, r;

int main(){
	scanf("%d", &N);
	int ans = 0;
	for(int i = 0; i < N; i++){
		scanf("%d %d", &l, &r);
		ans += (r - l + 1);
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 200000;

int main(void)
{
  int N, R[MAX];
  cin >> N;
  for (int i = 0; i < N; i++)
    cin >> R[i];
  
  int maxv = -1000000000;
  int minr = R[0];
  
  for (int i = 1; i < N; i++) {
    maxv = max(maxv, R[i] - minr);
    minr = min(minr, R[i]);
  }

  cout << maxv << endl;

  return 0;
}

Measured memory_bytes: 1940
import Control.Applicative

main = do
  [x, y] <- words <$> getLine
  let a = read x :: Int
  let b = read y :: Int

  if a < b then
    putStr "a < b"
  else if a > b then
    putStr "a > b"
  else
    putStr "a == b"

  putChar '\n'

Measured memory_bytes: 3580
using System;

class Program {
  static void Main() {
    var t = new string[3];
    while ((t[0] = Console.ReadLine()) != "0") {
      t[1] = Console.ReadLine();
      t[2] = Console.ReadLine();
      var a = '_';
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          var d = t[i][j];
          if (d == '+') continue;
          if (i + 2 < 3 && t[i + 1][j] == d && t[i + 2][j] == d) a = d;
          if (j + 2 < 3 && t[i][j + 1] == d && t[i][j + 2] == d) a = d;
          if (i + 2 < 3 && j + 2 < 3 && t[i + 1][j + 1] == d && t[i+2][j+2] == d) a = d;
          if (i + 2 < 3 && j - 2 >= 0 && t[i + 1][j - 1] == d && t[i + 2][j - 2] == d) a = d;
        }
      }
      Console.WriteLine(a == '_' ? "NA" : a.ToString());
    }
  }
}


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

using namespace std;
using ll = long long;
using v1 = vector<int>;
using vl = vector<long long>;
using v2 = vector<vector<int>>;
using v3 = vector<vector<char>>;

int main(){
	int n;
	cin >> n;
	int m = 1e8;
	int c = 0;
	rep(i, n){
		int x;
		cin >> x;
		if(x <= m){
			c++;
			m = x;
		}
	}
	cout << c << endl;
}


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

int main(){
  string s;
  cin >> s;
  for(int i = 0; i < s.size()-1; i++){
    if(s[i] == 'A' && s[i+1] == 'C'){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


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

void swap(int *,int *);

int main(void){
  int N,min,cnt=0;
  int *data;
  int i,j;

  scanf("%d",&N);

  data=(int *)malloc(sizeof(int)*N);

  for(i=0;i<N;i++){
    scanf("%d",&data[i]);
  }

  for(i=0;i<N-1;i++){
    min=i;
    for(j=i+1;j<N;j++){
      if(data[min]>data[j]) min=j;
    }
    if(min!=i){
      cnt++;
      swap(&data[min],&data[i]);
    }
  }

  printf("%d",data[0]);
  for(i=1;i<N;i++) printf(" %d",data[i]);
  printf("\n%d\n",cnt);

  free(data);

  return 0;
}

void swap(int *a,int *b){
  int work;

  work=*a;
  *a=*b;
  *b=work;
}

Measured memory_bytes: 600
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                         \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
       << " " << __FILE__ << endl;

// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
//

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

  int n;
  cin >> n;
  vector<int> h(n);
  rep(i, n) cin >> h[i];

  int res = 0, tmp = 0;
  rep(i, n - 1) {
    if (h[i] >= h[i + 1])
      tmp++;
    else
      tmp = 0;
    res = max(res, tmp);
  }

  cout << res << endl;

  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
#define ld long double
int main()
{
	int n, k; cin >> n >> k;
	int a[100005];
	for (int i = 0; i < n; i++)
		cin >> a[i];
	int ans = 1e9;
	sort(a, a + n, greater<int>());
	for (int i = k-1; i < n; i++)
		ans = min(ans, a[i - k+1] - a[i]);
	cout << ans;
}

Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#define LINE_NUM 2

int main(){
  char ring[101], p[101], line[LINE_NUM*101];
  scanf("%s", ring);
  scanf("%s", p);

  int ring_length, p_length;
  ring_length = strlen(ring);
  p_length = strlen(p);

  for(int i = 0; i < LINE_NUM; i++){
    strcpy((line+i*(ring_length)),ring);
  }

  if(strstr(line, p) != NULL){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  };

  return 0;
}

Measured memory_bytes: 964
N = int(input())
A = list(map(int, input().split()))

A.append(A[0])

x = 0
for i in range(N):
    if i % 2 == 1:
        x -= A[i]
    else:
        x += A[i]

output = list()
output.append(x)
for i in range(0, N - 1):
    output.append(2 * A[i] - output[i])

print(' '.join(map(str, output)))


Measured memory_bytes: 19144
// abc114_a
// #include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main(void) {
	int X;
	cin >> X;
	if (X == 7 || X == 5 || X == 3) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}

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

int main()
{
	int D = 0, G = 0, p[10], c[10];
	cin >> D >> G;
	repeat(i, D) cin >> p[i] >> c[i];

	//もうなんかいろいろ世界が天才すぎひん

	int minimum = 0;

	repeat(i, 1 << D) {

		int basepoint = 0;
		int mondaisuu = 0;
		repeat(ii, D) {
			if (i >> ii & 1) {
				basepoint += 100 * (ii + 1) * p[ii] + c[ii];
				mondaisuu += p[ii];
			}
		}

		if (basepoint >= G) {
			if (mondaisuu < minimum || minimum == 0) {
				minimum = mondaisuu;
			}
		}
		else{
			for (int ii = D - 1; ii >= 0; ii--) {
				if ((i >> ii & 1) == 0) {
					if (basepoint + 100 * (ii + 1) * p[ii] >= G) {
						mondaisuu += p[ii] - (p[ii] * 100 * (ii + 1) + basepoint - G) / (100 * (ii + 1));
						if (mondaisuu < minimum || minimum == 0) {
							minimum = mondaisuu;
						}
					}
					break;
				}
			}
		}
	}

	cout << minimum << endl;

	return 0;
}


Measured memory_bytes: 256
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using namespace std;

#define INF 100000000


int main() {
	int n, k;
	string s;
	cin >> n >> k >> s;

	s[k-1] = (s[k-1] + 'a' - 'A');
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
#include<map>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll p, ll n, ll m) {
	if (n == 0) return 1;
	else if (n == 1) return p % m;
	else if (n % 2 == 1) return p * pow_mod(p, n - 1, m) % m;
	else {
		ll tmp = pow_mod(p, n / 2, m);
		return (tmp * tmp) % m;
	}
}

ll gcd(ll x, ll y) {
	if (y == 0) {
		return x;
	}
	return gcd(y, x % y);
}

ll com_mod(ll n, ll k, ll m) {
	if (k == 0) return 1;
	else {
		ll x = 1;
		ll y = 1;
		for (ll i = 0; i < k; i++) {
			x = (x * (n - i)) % m;
			y = (y * (i + 1)) % m;
		}
		ll res = (x * pow_mod(y, m - 2, m)) % m;
		return res;
	}
}

int main() {
	char a; cin >> a;
	if (a == 'a' || a == 'i' || a == 'u' || a == 'e' || a == 'o')cout << "vowel" << endl;
	else cout << "consonant" << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
  vector<int> a;
  for(int i = 0; i <3; i++){
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
  sort(a.begin(), a.end());
  if((a[0] == a[1] && a[0] == 5) && (a[2] == 7)) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main(){

	for(int i=1;;i++){
	
	int a, b;
	string op;
	cin>>a>>op>>b;
	if(op == "?") break;
	
	int ans;
	if(op == "+") ans = a + b;
	if(op == "-") ans = a - b;
	if(op == "*") ans = a * b;
	if(op == "/") ans = a / b;

	cout<<ans<<endl;
	}

	return 0;
}



Measured memory_bytes: 3144
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <complex>
#include <set>
#include <list>
#include <iomanip>
#include <map>
#include <memory.h>
 
 
 
using namespace std;
static const double EPS = 1e-9;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a,0,sizeof(a))
#define minus(a) memset(a,0xff,sizeof(a))
#define chmax(a,b) a=min((a),(b))
#define chmin(a,b) a=max((a),(b))
 
 
#define MOD 1000000007
 
typedef pair<int,int>P;
#define INF (1<<29)
 
struct edge { 
	int from, to; 
	edge (int from, int to){
		this->from=from; this->to=to;
	}
};
 
int V,E;
typedef vector<edge> edges;
vector<edges> G;

ll n,a[300005];
ll f[100005];
ll b[100005];

int main() {
	scanf("%d ",&n);
	rep(i,3*n){
		scanf("%d ",&a[i]);
	}
	ll sumf=0,sumb=0; 
	priority_queue<ll> qf,qb;
	rep(i,n){
		sumf+=a[i];
		qf.push(-a[i]);
	}
	f[0]=sumf;
	ll t;
	rep(i,n){
		qf.push(-a[i+n]);
		t=qf.top();qf.pop();
		sumf=sumf+a[i+n]+t;
		f[i+1]=sumf;
	}
	rep(i,n){
		sumb+=a[i+2*n];
		qb.push(a[i+2*n]);
	}
	b[n]=sumb;
	for(int i=n-1;i>=0;i--){
		qb.push(a[i+n]);
		t=qb.top();qb.pop();
		sumb=sumb+a[i+n]-t;
		b[i]=sumb;
	}
	ll ans=-(1LL<<61);
	rep(i,n+1){
		ans=max(ans,f[i]-b[i]);
	}
	cout << ans << endl;
	return 0;
}




Measured memory_bytes: 5876
N = int(input())
suuretsu_str = input().split()
suuretsu = [int(i) for i in suuretsu_str]
suuretsu_order = [i for i in range(1,N+1)]
count = 0
for i in range(N):
    if suuretsu[i] != suuretsu_order[i]:
        count += 1
if count == 2 or count == 0:
    print("YES")
else:
    print("NO")

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

int main() {
    ll K; cin >> K;
    queue<ll> q;
    for (int i = 1; i < 10; ++i) q.push(i);
    for (int i = 1; i <= K - 1; ++i) {
        ll a = q.front();
        ll r = a % 10;
        q.pop();
        // cout<<"popped "<<a<<"\n";
        if (r) {q.push(10 * a - 1 + r);}
        q.push(10 * a + r);
        // cout<<"Pushed "<<10 * a + one_digit<<"\n";
        if (r != 9) {q.push(10 * a + 1 + r);}
    }
    cout << q.front() << endl;
}


Measured memory_bytes: 1792
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#define LL long long
using namespace std;

const int N=200000+5;
int n;
char s[N];
int sum[200],cnt[200];
LL ans;

int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	for(int i=1;i<=n;++i) sum[s[i]]++;
	for(int i=1;i<=n;++i){
		cnt[s[i]]++;
		ans+=n-i-(sum[s[i]]-cnt[s[i]]);//cout<<ans<<" ";
	}
	cout<<ans+1;
	return 0;
}

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

int main(){
	int a,b;
	cin >> a >> b;
	for(int i=0;i<=1250;i++){
		if(floor((double)i*0.08)==a and floor((double)i*0.1)==b)
			return cout << i << '\n',0;
	
	}
	cout << "-1\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;

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

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	cout<<((100*a+10*b+c)%4==0?"YES":"NO")<<endl;
	return 0;
}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int N, dpc[210][210], dpn[210][210];
vector<int> G[210];

vector<int> merge(vector<int> A, vector<int> B, int cur, int nxt) {
    vector<int> res((int)A.size() + (int)B.size() - 1);
    dpc[0][0] = 1;
    for(size_t i=0; i<A.size(); i++) {
        for(size_t j=0; j<B.size(); j++) {
            for(size_t k=0; k<=j; k++) {
                {
                    (dpc[j+1][k  ] += dpc[j][k]) %= MOD; // 被らせず置く
                    (dpn[j+1][k+1] += dpc[j][k]) %= MOD; // 被らせて進む
                    (dpn[j  ][k  ] += dpc[j][k]) %= MOD; // そのまま進む
                }

                // マージ (i 個の要素 A と j 個の要素 B を k 個被りで)
                (res[i+j-k] += A[i] * B[j] % MOD * dpc[j][k] % MOD) %= MOD;
            }
        }
        fill(dpc[0], dpc[B.size() + 2], 0);
        swap(dpc, dpn);
    }
    fill(dpc[0], dpc[B.size() + 2], 0);
    return res;
}

void dump_vec(vector<int> res) {
    for(size_t i=0; i<res.size(); i++) {
        fprintf(stderr, "%lld%c", res[i], " \n"[i+1 == res.size()]);
    }
}

vector<int> solve(int cur) {
    vector<int> res(1, 1);
    for(auto to : G[cur]) {
        auto vec = solve(to);
        res = merge(res, vec, cur, to);
    }
    res.insert(res.begin(), 0LL);
    // dump_vec(res);
    return res;
}

signed main() {
    cin >> N;
    vector<int> deg(N);
    for(int i=0; i<N-1; i++) {
        int u, v; cin >> u >> v;
        G[u].push_back(v);
        deg[v]++;
    }

    for(int i=0; i<N; i++) {
        if(deg[i] == 0) {
            int sum = 0;
            auto res = solve(i);
            for(auto e : res) (sum += e) %= MOD;
            cout << sum << endl;
            return 0;
        }
    }
    return 0;
}



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


int main() {
  string s;
  cin >> s;
  
  int cnt = 0;
  for (int i=0; i<3; i++) {
    if (s.at(i)=='1') cnt++;
  }
  
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3628
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;


#define SORT(c) sort((c).begin(),(c).end())
#define ANS(ans) cout<<(ans)<<endl;
typedef vector<int> VI;


//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)


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

	if (r < 1200) {
		cout << "ABC" << endl;
	}
	else if (r < 2800) {
		cout << "ARC" << endl;
	}
	else {
		cout << "AGC" << endl;
	}

	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>

using namespace std;
int h,w, n;
int a[10000];
int ans[100][100];
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  cin >> h >> w >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int count = 0, count_pos = 0;
  int ii = 0, jj = -1;
  bool left_to_right = true;
  int pos = 0;
  while (count < h*w) {
    if (left_to_right) {
      jj++;
      if (jj == w) {
        jj = w - 1;
        left_to_right = false;
        ii++;
      }
    } else {
      jj--;
      if (jj < 0) {
        jj = 0;
        ii++;
        left_to_right = true;
      }
    }

    if (count_pos >= a[pos]) {
      count_pos = 0;
      pos++;
    }

    ans[ii][jj] = pos + 1;
    count_pos++;
    count++;
  }

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


Measured memory_bytes: 384
import math
N = int(input())
n = N
ans = 0


def is_prime(n):
    if n == 1:
        return False
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


d = set()

for x, a in factorization(N):
    tmp = 1
    if x == 1:
        continue
    for i in range(a):
        tmp *= x
        d.add(tmp)

d = list(d)
d.sort()
for i in d:
    if N % i == 0:
        N = N // i
        ans += 1

print(ans)


Measured memory_bytes: 9516
#include <bits/stdc++.h>
using namespace std;
//vector<vector<int>> a(5, vector<int>(5, 0)) 5*5-0
int main(){
    long long int n;
    long long tmp;
    cin >> n;
    long long int res = 1;
    vector<int> a(n);
    int flag_zero = 0;
    int flag_18 = 0;
    for(int i = 0; i < n; i++){
        cin >> tmp;
        if(tmp == 0){
            flag_zero = 1;
            break;
        }
        if(tmp <= 1000000000000000000/res){
            res = res * tmp;
        }else{
            flag_18 = 1;
        }
    }
    
    //flag++;
    //cout << flag << endl;
    //cout << res << endl;

    if(flag_zero == 1){
        cout << 0 << endl;
    }else if(flag_18 == 1){
        cout << -1 << endl; 
    }else{
        cout << res << endl;
    }
}
//1000000000000000000
//9223372036854775807
//1000000000000000001

Measured memory_bytes: 3784
(args => {
  const [[N,M],...path] = args.trim().split('\n').map(a=>a.split(' ').map(a=>a|0));
  const dist = [], sign = [0], branch = [], stack = [[1]];
  for ( let i = 1; i <= N; i++ ) {
    dist[i] = Infinity; sign[i] = Infinity; branch[i] = [];
    stack[i] = [];
  }
  for ( let i = 0; i < M; i++ ) {
    const [A,B] = path[i];
    branch[A].push(B);
    branch[B].push(A);
  }
  for( let step = 0; step < N; step++ ) {
    while ( stack[step][0] ) {
      const i = stack[step].pop();
      for ( let next of branch[i] ) {
        if ( isFinite(dist[next]) ) continue;
        dist[next] = step;
        sign[next] = i;
        stack[step+1].push(next);
      }
    }
  }
  if ( sign.slice(2).some(v=>v>N) ) return console.log('No');
  console.log('Yes\n'+sign.slice(2).join('\n'));
})(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 120760
p = 998244353
n, k = map(int, input().split())
LRs = [tuple(map(int, input().split())) for _ in range(k)]
A = [0] * (2 * n + 1)
for lj, rj in LRs:
    A[lj] += 1
    A[rj + 1] -= 1
s = 0
for i in range(1, n):
    s = (s + A[i]) % p
    for lj, rj in LRs:
        A[i + lj] += s
        A[i + rj + 1] -= s
print(s)


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

int main() {
  string a,b;
  cin>>a;
  cin>>b;
  int d=0;
  int c=a.size();
  for(int i=0;i<c;i++){
      if(a.at(i)!=b.at(i)){
          d++;
      }
  }
  cout << d << endl;
}


Measured memory_bytes: 3904
void main(){
  import std.stdio, std.string, std.conv, std.algorithm;

  int n; rd(n);
  auto color=new char[](n*2), a=new int[](n*2);  
  auto pos_w=new int[](n*2), pos_b=new int[](n*2);
  fill(pos_w, -1); fill(pos_b, -1);
  foreach(i; 0..(n*2)){
    rd(color[i], a[i]); a[i]--;
    if(color[i]=='W') pos_w[a[i]]=i;
    else pos_b[a[i]]=i;
  }
  
  auto cnt_w=new int[][](n*2, n*2), // [i, n*2)にあるj以下の数の個数（白色の）
       cnt_b=new int[][](n*2, n*2);
  // auto cnt=new int[][](n*2, n*2);
  for(int i=n*2-1; i>=0; i--){
    for(int h=0; h<=i; h++){
      if(color[i]=='W') cnt_w[h][a[i]]++;
      else cnt_b[h][a[i]]++;
      // cnt[h][a[i]]++;
    }
  }
  foreach(i; 0..(n*2)){
    for(int j=1; j<(n*2); j++){
      cnt_w[i][j]+=cnt_w[i][j-1];
      cnt_b[i][j]+=cnt_b[i][j-1];
      // cnt[i][j]+=cnt[i][j-1];
    }
  }

  // writeln(cnt_w);
  // writeln(cnt_b);
  
  auto dp=new int[][](n+1, n+1);
  for(int i=0; i<=n; i++) fill(dp[i], 1_000_000_000);
  dp[0][0]=0;
  for(int i=0; i<=n; i++)for(int j=0; j<=n; j++){ // 白:0, 1, ..., i-1まで置いた；次置くのはi
    if(i<n){
      int cost_w=0;
      if(i-1>=0) cost_w+=cnt_w[pos_w[i]][i-1];
      if(j-1>=0) cost_w+=cnt_b[pos_w[i]][j-1];
      chmin(dp[i+1][j], dp[i][j]+cost_w);
    }
    if(j<n){
      int cost_b=0;
      if(j-1>=0) cost_b+=cnt_b[pos_b[j]][j-1];
      if(i-1>=0) cost_b+=cnt_w[pos_b[j]][i-1];
      chmin(dp[i][j+1], dp[i][j]+cost_b);
    }
  }
  writeln(dp[n][n]);
  // writeln(dp);
}

void chmin(T)(ref T l, T r){if(l>r)l=r;}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x) e=l[i].to!(typeof(e));
}

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

# define x first
# define y second
# define mp make_pair
// everything goes according to my plan
# define pb push_back
# define sz(a) (int)(a.size())
# define vec vector
// shimkenttin kyzdary, dzyn, dzyn, dzyn...
# define y1    Y_U_NO_y1
# define left  Y_U_NO_left
# define right Y_U_NO_right

# ifdef Local
# define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
# else
# define debug(...) (__VA_ARGS__)
# define cerr if(0)cout
# endif

using namespace std;

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

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const ll MXLL = 4e18;
const int Sz = 1110111;
// a pinch of soul
inline void Read_rap () {
  ios_base :: sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}
inline void randomizer3000 () {
  unsigned int seed;
  asm ("rdtsc" : "=A"(seed));
  srand (seed);
}
void files (string problem) {
  if (fopen ((problem + ".in").c_str(),"r")) {
    freopen ((problem + ".in").c_str(),"r",stdin);
    freopen ((problem + ".out").c_str(),"w",stdout);
  }
}
void localInput(const char in[] = "s") {
  if (fopen (in, "r")) {
    freopen (in, "r", stdin);
  }
  else
    cerr << "Warning: Input file not found" << endl;
}
int pr[2000];

int main()
{
  # ifdef Local
    //localInput();
  # endif
  Read_rap();
  int n;
  cin >> n;
     
  ll ans = 1;
  for (int i = 2; i <= n; i++) {
  	for (int j = i * i; j <= n; j += i) {
  		pr[j] = 1;
  	}
  	if (!pr[i]) { 
  		ll add = 0;
  		for (int x = n / i; x >= 1; x /= i) {
  			add += x;
  		}
  		ans *= (add + 1);
  		ans %= Mod;	
  	}
  }
  cout << ans;     	

  return 0;
}






// Coded by Z..

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)


const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * g / b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}




const long double PI = 3.14159265359;
const int MAX_N = 100010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int a, b, c, d, e, f; cin >> a >> b >> c >> d >> e >> f;
	P ans;
	double now = -1.0;
	for (int i = 0; i * a * 100 <= f; i++) {
		for (int j = 0; (i + a + j * b) * 100 <= f; j++) {
			if (i + j == 0)continue;
			int w = (i*a + j * b) * 100; int ms = min(f - w, e*w / 100);
			for (int k = 0; k * c <= ms; k++) {
				int l = (ms - k * c) / d;
				int s = k * c + l * d;
				if (now < 100.0 * s / (s + w)) {
					now = 100.0*s / (s + w);
					ans = P(s + w, s);
				}
			}
		}
	}
	cout << ans.first << " " << ans.second << endl;
	return 0;
}

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

using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); ++i)
double const PI = 3.1415926535897932384626433;

int main() {
    int k;
    int ans = 0;
    cin >> k;
    for (int i = 1; i <= k; ++i) {
        for (int j = 1; j <= k; ++j) {
            for (int l = 1; l <= k; ++l) {
                ans += __gcd(__gcd(i, j), l);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INF = 999999999;
const int MOD = (int)1e9 + 7;
const int EPS = 1e-9;



map<long long, int> PrimeFactor(ll n){
  map<long long, int> ret;
  for (ll i=2;i*i<=n;i++){
    while(n%i==0){
      ret[i]++;
      n/=i;
    }
  }
  if (n!=1){
    ret[n] = 1;
  }
  return ret;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b;
  cin >> a >> b;
  ll ans = 1;
  for(auto p : PrimeFactor(a)) {
  if (b % p.first == 0)ans++;
  }
  cout << ans << endl;
}

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

using namespace std;

using ll = long long;

const int N = 305, mod = 998244353;
int n, m, pow2[N << 1];
vector< bitset<N> > basis;

int lstBit(bitset<N> x) {
    int ret = -1;
    for (int i = 0; i < N; ++i) if (x[i]) ret = i;
    return ret;
}

void updBasis(bitset<N> val) {
    for (int i = 0; i < (int)basis.size(); ++i) {
        if (!val.count() ) return ;
        auto _ = basis[i];
        int lst_ = lstBit(_),
            lstVal = lstBit(val);
        if (lst_ == lstVal) val ^= _;
        else if (lst_ < lstVal) {
            basis.insert(basis.begin() + i, val);
            return ;
        }
    }
    if (val.count() ) basis.push_back(val);
}

int add(int _a, int _b) {
    _a += _b;
    if (_a >= mod) _a -= mod;
    return _a;
}
int sub(int _a, int _b) { return add(_a, mod - _b); }
int mul(int _a, int _b) { return (int)( (ll)_a * _b % mod); }

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

    cin >> n >> m;
    for (int i = 1; i <= n; ++i) {
        bitset<N> val;
        for (int j = 1; j <= m; ++j) {
            int a; cin >> a;
            val[j] = a;
        }
        updBasis(val);
    }

    pow2[0] = 1; for (int i = 1; i < (N << 1); ++i) pow2[i] = (int)(2 * pow2[i - 1] % mod);

    cout << sub(pow2[n + m - 1], pow2[n + m - 1 - (int)basis.size()]);

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] ans = new int[n];
    for(int i = 1; i < n; i++) { 
      int a = sc.nextInt() - 1;
      ans[a]++;
    }
    for(int i = 0; i < n; i++) {
      System.out.println(ans[i]);
    }
  }
}


Measured memory_bytes: 60516
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
	int n;cin >> n;
	vector<int> dv;
	for(int i = 0; i < n; i++){
		int d; cin >> d;
		dv.push_back(d);
	}
	sort(dv.begin(),dv.end());

	// cout << n/2 << endl;
	// cout << dv[(n/2) + 1] << endl;
	// cout << dv[(n/2) ] << endl;
	cout << dv[(n/2)] - dv[n/2 - 1] << endl;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

  
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);  
  
  string t;
  int n;
  cin >> t >> n;
  int ans=0;
  rep(i,n){
    string s;
    cin >> s;
    s+=s;
    bool ok=false;
    rep(j,s.size()-t.size()+1){
      string u = s.substr(j,t.size());
      if(u==t)ok=true;
    }
    if(ok)ans++;
  }
  cout << ans << endl;

  
}



Measured memory_bytes: 3208
s=list(input())
k=int(input())

from collections import Counter
l=Counter(s)
if len(l)==1:
    print(len(s)*k//2)
    exit()

f=1
ans=0
for i in range(len(s)-1):
    if f and s[i]==s[i+1]:
        ans+=1
        f=0
    else:
        f=1

if s[0]!=s[-1]:
    print(ans*k)
else:
    ans2=0
    ss=s+s
    f=1
    for i in range(2*len(s)-1):
        if f and ss[i]==ss[i+1]:
            ans2+=1
            f=0
        else:
            f=1
    print(ans+(ans2-ans)*(k-1))


Measured memory_bytes: 3316
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _20170409_AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();

            string[] sArr = line.Split(' ');
            int a = int.Parse(sArr[0]);
            int b = int.Parse(sArr[1]);
            int c = int.Parse(sArr[2]);
            int count = 0;

            for (int i = a; i <= b; i++)
            {
                if (c % i == 0)
                {
                    count++;
                }
            }

            Console.WriteLine(count);

            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 9136
#include <bits/stdc++.h>
using namespace std;
#define M 30005
#define N 1005

int main()
{
    int a,b,c,p;
    cin>>a>>b>>c;
    if((100*a+10*b+c)%4==0)printf("YES");
    else printf("NO");
    return 0;
}


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

#define MAX_H 100
#define MAX_W 100

char map[MAX_H][MAX_W];
int H, W;

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

void dfs(char kind, int x, int y)
{
	map[x][y] = '.'; // 探索済みの場所は"."に置き換える
	
	for(int i=0; i<4; i++){
		int nx = x + dx[i], ny = y + dy[i];
		if( 0<=nx && nx<H && 0<=ny && ny<W && map[nx][ny]==kind ) dfs(kind, nx, ny);
	}
}


int main()
{
	while(1){
	cin>>H>>W;
	if(!H&&!W)break;

	for(int i=0; i<H; i++)
		for(int j=0; j<W; j++)
			cin>>map[i][j];
	int count=0;
	for(int i=0; i<H; i++)
		for(int j=0; j<W; j++)
			switch(map[i][j]){
			case '#':{ dfs('#', i, j);count++;break;}
			case '@':{ dfs('@', i, j);count++;break;}
			case '*':{ dfs('*', i, j);count++;break;}
			}
	cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 1632
N,M=map(int, input().split())
P=[0]+list(map(int, input().split()))
E=[[] for _ in range(N+1)]
for _ in range(M):
    x,y=map(int, input().split())
    E[x].append(y)
    E[y].append(x)

ans=[0]*(N+1)
parent=[0]*(N+1)

for root in range(1,N+1):
    if parent[root]: continue
    parent[root]=root
    stack=[root]
    nodes=set()
    values=set()
    while stack:
        node=stack.pop()
        nodes.add(node)
        values.add(P[node])
        for to in E[node]:
            if parent[to]: continue
            parent[to]=node
            stack.append(to)
    for i in nodes&values:
        ans[i]=1

print(sum(ans))

Measured memory_bytes: 88812