akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

#define debug(x) cerr<<#x<<'='<<x<<'\n'
#define Int const int &
int n, a, b;
int work(int k) {
	int sum=0, p=k;
	for (; k; k/=10) {
		sum+=k%10;
	}
//	debug(sum);
	if (sum<=b && sum>=a) return p;
	else return 0;
}
int ans=0;
int main(void) {
	cin>>n>>a>>b;
	for (int i=1; i<=n; i++) {
		ans+=work(i);
	}
	cout<<ans;
	return 0;
}

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

#ifdef DEBUG
#include "../include/debug.hpp"
#else
#define debug(...) 42
#endif

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

    int A, P;
    cin >> A >> P;

    int sum = A*3 + P;

    cout << sum / 2 << endl;

    return 0;
}

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

int main(){
  int town[1000000] = {0};
  int n, m;
  int ans = 0;
  int now = 0;
  scanf("%d%d", &n, &m);
  town[0] = 0;
  for(int i = 1; i < n; i++){
    scanf("%d", &town[i]);
  }

  /*
  for(int i = 0; i < n; i++)
    printf("town%d:%d\n", i, town[i]);
  */

  for(int i = 0; i < m; i++){
      int h;
    scanf("%d", &h);
    //printf("now:%d ans:%d\n", now, ans);

    if(h > 0){
      for(int j = 0; j < h; j++){
        ans += town[++now];    
        //printf("mooov:%d\n", town[now]);
      }
    }else{
      for(int j = 0; j < -h; j++){
        ans += town[now--];
        //printf("mooov:%d\n", town[now]);
      }
    }

    ans %= 100000;
  }
  printf("%d\n", ans);
}

Measured memory_bytes: 5104
using System;

public class AtCoderB
{
    static void Main()
    {
        double h;
        int n;
        {
            var line = Console.ReadLine();
            var words = line.Split(' ');
            h = double.Parse(words[0]);
            n = int.Parse(words[1]);
        }

        double sum = 0;
        var line2 = Console.ReadLine();
        var words2 = line2.Split(' ');
        for (int i = 0; i < n; i++)
        {
            sum += double.Parse(words2[i]);
        }

        if (sum >= h)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 16480
#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
#include <numeric>
#include <string>

using namespace std;



int main()
{
        int N, M;
        cin >> N >> M;
        string s;
        cin >> s;
        vector<int> ListCount;
        int count=1;
        char p=s[0];
        for(int i=1; i<N; i++){
                if(s[i]==p){count++;}
                else{ListCount.push_back(count);
                        p=s[i];
                        count=1;
                        }
        }
        ListCount.push_back(count);
        sort(ListCount.begin(), ListCount.end());
        int Length;

        Length = ListCount.size();
        Length = Length - 2*M;
        if(Length <= 0 ) Length = 1;
        cout << N - Length;
}

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

mod = 1000000007

c = [0,0,0]
ans = 1
for a in A:
    ans *= c.count(a)%mod
    for i in range(3):
        if c[i]==a:
            c[i]+=1
            break

print(ans%mod)

Measured memory_bytes: 14396
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pii pair <int,int>
#define pll pair <ll,ll>
#define testcase() int t; cin>>t; while(t--)
#define forn(i,n) for(int i=0;i<n;i++)
#define forn1(i,n) for(int i=1;i<=n;i++)
#define vll vector <ll>
#define vi vector <int>
#define all(v) v.begin(),v.end()

ll M = 1e9 + 7;
double pi = acos(-1.0);
ll powerm(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x)%M; y=y>>1; x=(x*x)%M;} return res%M; }
ll power(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x); y=y>>1; x=(x*x);} return res; }
ll gcd(ll a,ll b){if(b>a)return gcd(b,a); if(b==0)return a; return gcd(b,a%b);}

int main() {
	
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	
	int n,m,k; cin>>n>>m>>k;
	string s[n];
	forn(i,n) cin>>s[i];
	int cc = 0;
	forn(i,n)
	{
		forn(j,m) if(s[i][j]=='#') cc++;
	}
	//cout<<cc<<endl;
	if(cc<k){ cout<<0; return 0; }
	int ans = 0;
	int g = 1<<n, h = 1<<m;
	forn(i,g)
	{
		forn(j,h)
		{
			bitset <7> b1(i), b2(j);
			int d = 0;
			forn(p,n)
			{
				if(b1[p]==1)
				{
					forn(f,m) if(s[p][f]=='#') d++;
				}
			}
			forn(p,m)
			{
				if(b2[p]==1)
				{
					forn(f,n) if(s[f][p]=='#' && b1[f]==0) d++;
				}
			}
			
			//forn(y,7) cout<<b1[y]; cout<<endl;
			//forn(y,7) cout<<b2[y]; cout<<endl;
			//cout<<d<<endl;
			if(cc-d==k) ans++;
		}
	}
	cout<<ans;

	return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << x << "\n"

using namespace std;
typedef long long ll;
typedef pair <int,pair <int,int > > pii;

const int MOD = 1000000007;
map <string,int> mp;
int main()
{
    int a,b,c,ok = 0;
    cin >> a;
    while(a--){
        string s;
        cin >> s;
        mp[s]++;
        ok = max(ok, mp[s]);
    }
    for(auto x : mp){
        if(x.second == ok)
            cout << x.first << "\n";
    }
    return 0;
}


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

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

  for (int i = 0; i < n; i++) {
    if (s[i] != s[k-1]) {
      s[i] = '*';
    }
  }

  cout << s << endl;
}

Measured memory_bytes: 256
import sys
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: tuple(map(int,input().split()))

M = int(input())
S = 0
ans = -1
for _ in range(M):
    d, c = inpl()
    S += d * c
    ans += c

while S >= 10:
    q, r = S//10, S % 10
    ans += q
    S = q + r
print(ans)


Measured memory_bytes: 41308
#include <iostream>
using namespace std;
int main() {
    int A, B;
    cin >> A >> B;
    int answer;
    for (int i = A; i <= B ; i++) {
        if (i/ 10%10 == i/1000%10&&i%10==i/10000%10) {
            answer++;
        }
    }
    cout << answer << endl;
	
}

Measured memory_bytes: 256
def main():
        N = int(input())
        S = [input() for i in range(N)]

        n_ac = 0
        n_wa = 0
        n_tle = 0
        n_re = 0

        for i in range(N):
                temp = S[i]
                if temp=="AC":
                        n_ac+=1
                elif temp=="WA":
                        n_wa+=1
                elif temp=="TLE":
                        n_tle+=1
                else:
                        n_re+=1

        print("AC x",n_ac)
        print("WA x",n_wa)
        print("TLE x",n_tle)
        print("RE x",n_re)

main()

Measured memory_bytes: 16324
#include<stdio.h> 

int main(void) 
{    
	int i,j;     
	int r,c;     
	int sum=0;     
	int total=0;     
	int hyou[100][100];       
	for(i=0;i<100;i++)
	{         
		for(j=0;j<100;j++)
		{             
			hyou[i][j]=0;        
		}     
	}     
		scanf("%d %d",&r,&c);    
		for (i=0;i<r;i++)
		{        
			for(j=0;j<c;j++)
			{             
				scanf("%d",&hyou[i][j]);         
			}     
		}        
		for(i=0;i<r;i++)
		{         
			for(j=0;j<c;j++)
			{            
				printf("%d ",hyou[i][j]);             
				sum+=hyou[i][j];        
			}         
			printf("%d\n",sum);         
			sum=0;     
		}         
		for(j=0;j<c;j++)
		{         
			for(i=0;i<r;i++)
			{             
				sum+=hyou[i][j];                       
			}     
			printf("%d ",sum);     
			total+=sum;     
			sum=0;     
		}     
		printf("%d\n",total);     
		return 0; 
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))


using namespace std;


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




ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

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

long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}


const int MOD = 1000000007;

int rui[300000];
int main() {
	string s;
	cin>>s;
	ll n=s.length();
	VREVERSE(s);
	m0(rui);
	if(s[0]=='W')rui[0]=1;
	FOR(i,1,n){
		if(s[i]=='W'){
			rui[i]=rui[i-1]+1;
		}
		else{
			rui[i]=rui[i-1];
		}
	}
	ll ans=0;
	REP(i,n){
		if(s[i]=='B'){
			ans+=rui[i];
		}
	}
	cout<<ans<<endl;
}

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

int main(){
	int a,b;
	string s;
	cin>>a>>b>>s;
	bool check=true;
	for(int i=0;i<a+b+1;i++){
		if(i==a)continue;
		int num=(int)(s[i]-'0');
		if(0>num || num>9){
			check=false;
			break;
		}
	}
	if(s[a]=='-' &&check)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

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

using namespace std;
#define NUM 7368792

int main(){

	int m,n;
	char *data;
	data = new char[NUM];
	int cnt=0;

	while(cin>>m>>n){
		if(m==0 && n==0)break;
		for(int i=0;i<NUM;i++){
			data[i]=0;
		}
		cnt=0;
 		for(int i=m;cnt<n;i++){
 			if(data[i]==1){
 				continue;
 			}
 			for(int j=i;j<NUM;j+=i){
 				data[j]=1;
 			}
 			cnt++;
 		} 		
 		for(int i=0;i<NUM;i++){
 			//cout<<data[i]<<endl;
 			if(data[i]==0 && i>m){
 				cout<<i<<endl;
 				break;
 			}
 		}

 	}

 	return 0;
}

Measured memory_bytes: 10260
#define _USE_MATH_DEFINES

#include <cmath>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <bitset>

using namespace std;

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

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

int n, k;

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

    string s;
    cin >> n >> k >> s;
    vector<P> v;
    for (int i = 0; i < n; ++i) {
        if (v.empty() || v.back().first != s[i]) v.emplace_back(s[i], 1);
        else v.back().second++;
    }

    int ans = 0, cur = 0, sum = 0, len = 0;
    for(auto &p : v){
        while(cur < v.size() && sum + (v[cur].first == '0') <= k){
            sum += v[cur].first == '0';
            len += v[cur].second;
            ++cur;
        }
        ans = max(ans, len);
        sum -= p.first == '0';
        len -= p.second;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1528
N,K = map(int,input().split())
p = list(map(int,input().split()))

l = []
for i in range(N):
    l.append(((1+p[i])*p[i]/2)/p[i])

s = [0]*(N+1)
for i in range(1,N+1):
    s[i] = l[i-1]+s[i-1]

ans = 0
for i in range(K,len(s)):
    ans = max(ans,s[i]-s[i-K])

if N == K:
    print(max(s))
else:
    print(ans)

Measured memory_bytes: 32628
def dfs(x,c):
	if x==N-1:
		if all(visited):
			global ans
			ans += 1
		return

	for i in range(N):
		if neighbor[c][i] and not visited[i]:
			visited[i] = True
			dfs(x+1,i)
			visited[i] = False
		
N, M = map(int,input().split())
edge = [[int(i) for i in input().split()] for i in range(M)]
neighbor = [[False for i in range(N)] for i in range(N)]
visited = [False for i in range(N)]
for i in range(M):
	neighbor[edge[i][0]-1][edge[i][1]-1] = True
	neighbor[edge[i][1]-1][edge[i][0]-1] = True
	
ans = 0
visited[0] = True
dfs(0,0)
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <bitset>
using namespace std;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define pii pair<int, int>
#define vi vector<int>
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
 
typedef long long ll;
typedef short inth;
 
const int N = 2e5;
const int M = N + 7;
const int MOD = 1e9 + 7;
const ll INF = 1e16 + 17;

int a[M];

int main() {
    int n, k;
    scanf("%d %d", &n, &k);
    ll sum = 0;
    for (int i = 0; i < n; ++i) {
        scanf("%d", &a[i]);
        ll last = sum;
        sum += a[i];
        if (i >= k)
            sum -= a[i - k];
        if (i >= k && sum > last) {
            printf("Yes\n");
        } else if (i >= k) {
            printf("No\n");
        }
    }
    return 0;
}

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

using namespace std;

int main()
{
    vector<char> s(3);

    cin >> s[0] >> s[1] >> s[2];

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

    if (s[0] == 'a' && s[1] == 'b' && s[2] == 'c') {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

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

int main() {
  int n;
  cin >> n;
  int ans = 0;
  int pmin = INT_MAX;
  int tmp;
  for(int i = 0; i<n; i++) {
    cin >> tmp;
    if(pmin >= tmp) {
    	ans++;
      	pmin = tmp;
    }
  }
  
  cout << ans << endl;
  
  
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

// ABC 32-C
// http://abc032.contest.atcoder.jp/tasks/abc032_c
 
public class Main {

	public static void main (String[] args) throws java.lang.Exception {
		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
		int[] nums = new int[n];
		
		int answer = 1;
		int state = 0; // 0 means it can go either up or down. 1 means it must be increasing or equal. 2 means it must be decreasing or equal
		for (int i = 0; i < n; i++) {
			nums[i] = in.nextInt();
			if (i > 0) {
				// Direction is not determined
				if (state == 0) {
					if (nums[i - 1] < nums[i]) {
						state = 1;
					} else if (nums[i - 1] > nums[i] ) {
						state = 2;
					}
				} else if (state == 1) {
					if (nums[i - 1] > nums[i]) {
						state = 0;
						answer++;
					}
				} else {
					if (nums[i - 1] < nums[i]) {
						state = 0;
						answer++;
					}
				}
			}
		}
		System.out.println(answer);
		
		
	}
	
}

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

int main(){
	int I=0,J=0;
	char d[10000];
	while(cin>>d){
		for(int i=0;i<10000;i++) if(d[i+2]==0) break; else {
			if(d[i+1]=='O'&&d[i+2]=='I'){
				if(d[i]=='J') J++;
				if(d[i]=='I') I++;
			}
		}
		printf("%d\n%d\n",J,I);
		I=0,J=0;
	}
}

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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rng(i,a,b) for(int i = (a); i < (b); ++i)
#define pow2(n) (1<<n)
#define rev(x,n) (x) ^= pow2(n);

int n, s, t, N;
vector<int> ans;

int popcount(int x) {
    int res = 0;
    while (x > 0) res+=x&1, x>>=1;
    return res;
}

int diffbit(int a, int b) {
    int res = 0;
    while ((a&pow2(res)) == (b&pow2(res))) res++;
    return res;
}

void solve(int l, int r, int a, int b, vector<int> used) {
    if (l == r-1) return;
    int mid = (l + r) / 2;
    
    int db = diffbit(a, b);
    rng(i,l,r) ans[i] = a;
    rng(i,mid,r) rev(ans[i], db);
    used[db] = 1;

    rep(i,n) if (!used[i]) {
        rev(ans[mid-1], i);
        rev(ans[mid], i);
        break;
    }
    solve(l, mid, a, ans[mid-1], used);
    solve(mid, r, ans[mid], b, used);
}

int main() {
    cin >> n >> s >> t, N = pow2(n);
    ans.assign(N,0);
    if (popcount(s)%2 == popcount(t)%2) {
        cout << "NO" << endl;
        return 0;
    }
    solve(0,N,s,t,vector<int>(n,0));
    cout << "YES" << endl;
    rep(i,N) cout << ans[i] << " \n"[i==N-1];
    return 0;
}


Measured memory_bytes: 1536
#include "bits/stdc++.h"

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;

	if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0)
		cout << "Possible" << endl;
	else
		cout << "Impossible" << endl;

	return 0;
}

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

string S;
vector<long long> vals[100]; // 深さ d のところに一時格納する値たち

long long solve() {
  for (int i = 0; i < 100; ++i) vals[i].clear();
  int depth = 0;
  int val = 0;
  for (int i = 0; i < S.size(); ++i) {
	if (S[i] == '[') ++depth;
	else if (S[i] == ']') {
	  if (val) vals[depth].push_back((val+1)/2);
	  val = 0;
	  sort(vals[depth].begin(), vals[depth].end());
	  long long sum = 0;
	  for (int j = 0; j*2 < vals[depth].size(); ++j) sum += vals[depth][j];
	  vals[depth-1].push_back(sum);
	  vals[depth].clear();
	  --depth;
	}
	else {
	  val *= 10;
	  int c = (int)(S[i] - '0');
	  val += c;
	}
  }
  return vals[0][0];
}

int main() {
  int N; cin >> N;
  for (int i = 0; i < N; ++i) {
	cin >> S;
	cout << solve() << endl;
  }
}


Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007

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

	int n, k;
	cin >> n >> k;
	int a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int dp[n + 1][k + 1];
	memset(dp, 0, sizeof(dp));
	int curr = 0;
	for (int i = 0; i <= k; i++) {
		if (i <= a[0])
			curr += 1;
		dp[1][i] = curr;
	}
	for (int i = 0; i <= n; i++)
		dp[i][0] = 1;
	for (int i = 2; i <= n; i++) {
		curr = 1;
		for (int j = 1; j <= k; j++) {
			int sub = 0;
			if (j - a[i - 1] <= 0) {
				sub = (dp[i - 1][j]) % mod;
			} else {
				sub = (dp[i - 1][j] - dp[i - 1][j - a[i - 1] - 1] + mod) % mod;
			}
			curr = (curr + sub) % mod;
			dp[i][j] = curr;
		}
	}
	cout << (dp[n][k] - ((k - 1 < 0) ? 0 : dp[n][k - 1]) + mod) % mod;
	return 0;
}

Measured memory_bytes: 43008
/*------------------------- Bism Allah Alruhmin Alrahim -------------------------------*/
#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < n; i++)
#define ford(i, n) for (int i = n - 1; i > -1; i--)
#define forl(i, l, r) for (int i = l; i <= r; i++)
#define vc vector
#define f first
#define s second
#define pb(i) push_back(i)
#define mx(ar, n) (*max_element(ar, ar + n))
#define mn(ar, n) (*min_element(ar, ar + n))

using namespace std;

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

ll LCM(ll x , ll y){
	return (x*y) / __gcd(x,y) ;
}

ll NumOfDiv(ll a , ll b , ll k){
	return b/k - a/k + (a%k == 0) ;
}
void start(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
map<char, int> map;
int main()
{
	start();
	string s ; 
	cin >> s;
	int x[26] = {0} ;
	for (int i = 0; i < s.size(); ++i)
	{
		x[s[i] - 'A']++;
	}
	int a = 0 ;
	for (int i = 0; i < 26; ++i)
	{
		if(x[i] == 2){
			a++;
		}
	}
	if(a == 2){
		cout << "Yes" << endl ;
	}
	else{
		cout << "No" << endl ;
	}

	return 0 ;
}

Measured memory_bytes: 256
#include<stdio.h>
void bubbleSort(int*, int);

int main(){
    
    int S[100];
    int i, j, s, t;
    
    scanf("%d",&s);
    for(i=0 ; i<s ; i++){
        scanf("%d",&S[i]);
    }
    
    bubbleSort(S, s);
    
    return 0;
}

void bubbleSort(int *A,int b){
    int i,j;
    int flag = 1,cont=0;
    
    while(flag){
        flag = 0;
        for(i=b-1 ; i>=1 ; i--){
            if(A[i]<A[i-1]){
                j = A[i];
                A[i] = A[i-1];
                A[i-1] = j;
                flag = 1;
                cont++;
            }
        }
    }
    
    for(i=0 ; i<b ; i++){
        if(i==b-1){
            printf("%d\n", A[i]);
        }else{
            printf("%d ", A[i]);
        }
    }
    printf("%d\n",cont);
}


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

#define rep(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define PII pair<int,int>
#define INF LONG_MAX
#define ull unsigned long long
#define long long long
#define PIL pair<long,int>
#define M 1000000007
#define endl "\n"

void fastIO() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

}

int n,m;
vector<int> adj[300001];

int diffEl = 0;
void dfs(int start,vector<int> &vis){
    diffEl++;
    vis[start] = 1;
    for(auto i:adj[start]){
        if(!vis[i]){
            dfs(i,vis);
        }
    }
}
int main()
{
	fastIO();
    cin>>n>>m;
 
    vector<int> vis2(n+1,0);
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        adj[a].push_back(b);
        adj[b].push_back(a);
        vis2[a] = true;
        vis2[b] = true;
    }
    int difSet = 0;
    vector<int> el;
    vector<int> vis1(n+1,0);
    for(int i=1;i<=n;i++){
        if(vis1[i] || !vis2[i]){
            continue;
        }
        dfs(i,vis1);
        difSet++;
        el.push_back(diffEl);
        diffEl = 0;
    }
    int ans   = 1;
    for(int i=0;i<el.size();i++){
        ans = max(el[i],ans);
    }
    cout<<ans;
    return 0;
}



Measured memory_bytes: 24136
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n,a,b;
  cin>>n>>a>>b;
  cout<<min(n*a,b)<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
 ll n,k;
  cin>>n>>k;
  ll a[n];
  for(ll i=0;i<n;i++)cin>>a[i];
  ll ans=0;
  for(ll i=0;i<n;i++)if(a[i]>=k)ans++;
  cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 2222222222222222222LL;
const ll mod = 1000000007LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok;
ll dx[9] = { 0,1,-1,0,0,1,1,-1,-1 }, dy[9] = { 0,0,0,1,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222






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



  cin >> s;
  rep(i, s.size()) {
    if (i % 2) {
      if (s[i] == '0') tmp++;
    }
    else {
      if (s[i] == '1') tmp++;
    }
  }
  rep(i, s.size()) {
    if (i % 2) {
      if (s[i] == '1') ans++;
    }
    else {
      if (s[i] == '0') ans++;
    }
  }
  cout << min(ans, tmp) << endl;



  return 0;
}

Measured memory_bytes: 512
#include<stdio.h>

int main(){
  long d,g,p[10],c[10],dp[1010][11]={},a[10],b,co[10][2],sum=0,maxx=0,sa,sumx;
  long f[10],n=1,num,ans;
  scanf("%ld %ld",&d,&g);
  for(long i=0;i<d;i++){
    n*=2;
    scanf("%ld %ld",&p[i],&c[i]);
  }
  for(long i=0;i<d;i++){
    co[i][0]=(1+i)*p[i]*100+c[i];
    co[i][1]=p[i];
  }
  for(long i=1;i<=1000;i++){
    for(long j=0;j<n;j++){
      num=j;
      sum=0;
      sumx=0;
      for(long k=0;k<d;k++){
        f[k]=num%2;
        num/=2;
        sum+=f[k]*p[k];
        sumx+=co[k][0]*f[k];
      }
      if(i>=sum){
        sa=i-sum;
        for(long k=d-1;k>=0;k--){
          if(f[k]==0){
            if(sa<p[k]){
              sumx+=sa*(k+1)*100;
              sa=0;
              break;
            }
            else{
              sumx+=p[k]*(k+1)*100;
              sa-=p[k];
            }
          }
        }
        if(maxx<sumx){
          maxx=sumx;
        }
      }
    }
    if(maxx>=g){
      ans=i;
      break;
    }
  }
  printf("%ld\n",ans);
}

Measured memory_bytes: 128
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    long long a;
    long long m;
    int k=0;
    long double p;
    double b;
    cin>>a>>b;
    p=round(b*100);
    m=(a*p)/100;
    cout<<m<<endl;
    return 0;
}


Measured memory_bytes: 3728
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
using namespace std;
#define LATTE 10000

int main(){
	int A,B;
	cin>>A>>B;
	if(A<B) puts("a < b");
	else if(A>B) puts("a > b");
	else puts("a == b");
    return 0;
}

Measured memory_bytes: 1116
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stdio.h>
#include <string.h>
using namespace std;

struct Graph {
    Graph(int n) : e(n), v(n, pair<int, int>{ 0, -1 }), v2(n) {}
    void add_edge(int i, int j) {
        e[i].push_back(j);
    }
    void foo(int i0, int d0, int c, int k) {
        queue<pair<int, int>> q;
        q.push({ i0, d0 });
        while (!q.empty()) {
            pair<int, int> o = q.front(); q.pop();
            int i = o.first;
            int d = o.second;
            if (v2[i] == k || d <= v[i].second) continue;
            if (v[i].first == 0) v[i].first = c;
            v[i].second = d;
            v2[i] = k;
            for (int j : e[i]) {
                q.push({ j, d - 1 });
            }
        }
    }
    vector<vector<int>> e;
    vector<pair<int, int>> v;
    vector<int> v2;
};

int main() {
    int n, m;
    cin >> n >> m;
    Graph g(n);
    for (int i = 0; i < m; i++) {
        int a, b;
        scanf("%d%d", &a, &b);
        a--; b--;
        g.add_edge(a, b);
        g.add_edge(b, a);
    }
    int q;
    cin >> q;
    vector<int> v(q), d(q), c(q);
    for (int i = 0; i < q; i++) {
        scanf("%d%d%d", &v[i], &d[i], &c[i]);
        v[i]--;
    }

    for (int i = q - 1; i >= 0; i--) {
        g.foo(v[i], d[i], c[i], i + 1);
    }

    for (int i = 0; i < n; i++) {
        printf("%d\n", g.v[i].first);
    }

    return 0;
}

Measured memory_bytes: 9372
#include <iostream>
#include <vector>
#include <algorithm>
#include <bits/stdc++.h>

using namespace std;


long long int a,b,c[110],d[100010],ans =0,ant=0;

int main(){
  cin >> a ;
  
    for(long long int i=0;i<a;i++){
      cin >> c[i];
      ans += c[i];
    }
 
  sort(c,c+a);
  
  if(ans %10 !=0){
    cout << ans << endl;
    
    return 0;
  }
  
  else {
  
  for(int i=0;i<a;i++){
    
    if(c[i] %10 !=0){
      ans -= c[i];
      
      cout << ans << endl;
      
      return 0;
    }
  }
    
  }
  cout << "0" << endl;
}

  
  
  
  
  


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  //freopen("data.in", "r", stdin);
  ld a, b, h, m;
  cin >> a >> b >> h >> m;
  ld aa = (h+m/60.0)/12.0;
  ld bb = (m/60.0);
  ld d = (ld) abs((ld)aa-bb)*360.0;
  d *= M_PI / 180.0;
  printf("%.20LF", (ld) sqrt((ld)a*a + b*b - 2*a*b*cos(d)));
  return 0;
}


Measured memory_bytes: 4096
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <vector>
using namespace std;
#define FOR(__I,__N) for (int __I = 0; __I < __N; ++__I)

typedef long long int64;
typedef pair<int,int> pii;
typedef pair<int64, int64> pll;



const int MAX_N = 200000;
int A[MAX_N], B[MAX_N];

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

	sort(A,A+N);
	sort(B,B+N);
	if(N&1){
		int64 lb = A[N/2], ub = B[N/2];
		int64 ans = (ub-lb)+1;
		printf("%lld\n",ans);
	}else{
		int64 lb = A[N/2-1]+A[N/2], ub = B[N/2-1]+B[N/2];
		int64 ans = (ub-lb)+1;
		printf("%lld\n",ans);
	}
}




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

int main() {
	int N, K;
	cin >> N >> K;
	if (K > (N - 1) * (N - 2) / 2) {
		cout << -1 << endl;
		return 0;
	}
	int num = (N - 1) * (N - 2) / 2 - K;

	cout << N - 1 + num << endl;
	for (int i = 0; i < N - 1; i++) {
		cout << i + 1 << " " << N << endl;
	}
	for (int i = 1; i <= N - 2; ++i) {
		for (int j = i + 1; j <= N - 1; ++j) {
			if (num > 0) {
				cout << i <<  " " << j << endl;
				num--;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void) {

    int n;
    int k;
    int x;
    int y;

    cin >> n >> k >> x >> y;

    if(n <= k) cout << n * x << endl;
    else cout << k * x + (n - k) * y << endl;

    return 0;

}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int X, A, B;
    cin >> X >> A >> B;
    
    if ( B-A <=0) {
        cout << "delicious" << endl;
    } else if ( B-A >= (X+1) ) {
        cout << "dangerous" << endl;
    } else {
        cout << "safe" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <stdlib.h>
#include<time.h>
#include<cmath>
#include<vector>
using namespace std;

int main(void)
{
	int n, k,factorial,ans;
	cin >> n >> k;

	if (n == 1) {
		ans = k;
		cout << ans;
	}
	else {
		factorial = 1;
		for (int i = 0; i < (n - 1); i++) {
			factorial = factorial * (k - 1);
		}
		ans = k * factorial;
		cout << ans;
	}

	cout << endl;
}


Measured memory_bytes: 384
S = input()


l, r = 0, len(S) - 1
ans = 0

while l < r:
    if S[l] == S[r]:
        l += 1
        r -= 1
    else:
        if S[l] == 'x':
            ans += 1
            l += 1
        elif S[r] == 'x':
            ans += 1
            r -= 1
        else:
            print(-1)
            exit()

print(ans)


Measured memory_bytes: 3316
#include<iostream>
#include <stdio.h>
using namespace std;
 
int main(){
  int x,y,z,tmp;

  cin >> x >> y >> z;

  if(x>y){
    tmp=x;
    x=y;
    y=tmp;
  }
  if(y>z){
    tmp=y;
    y=z;
    z=tmp;
  }
  if(x>y)
  {
    tmp=x;
    x=y;
    y=tmp;
  }
  printf("%d %d %d\n",x,y,z);
  //cout << x << " " << y << " " << z << endl;
  

  return 0;		 
}


Measured memory_bytes: 3120
/*
 * FileName:     H_fix_3
 * CreatedDate:  2020-05-19 23:43:15 +0900
 * LastModified: 2020-05-20 00:14:46 +0900
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
long int dp[1000][1000];
void print_dp(int h,int w){
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            printf("%ld ",dp[i][j]);
        }
        printf("\n");
    }
}
int main(void){
    int h,w;
    scanf("%d %d",&h,&w);
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            dp[i][j]=1;
        }
    }
    for(int i=0;i<h;i++){
        char moji[w];
        scanf("%s",moji);
        for(int j=0;j<w;j++){
            if(moji[j]=='#'){
                dp[i][j]=0;
            }
        }
    }
    int flag=0;
    for(int i=0;i<h;i++){
        if(dp[i][0]==0){
            flag=1;
        }
        if(flag==1){
            dp[i][0]=0;
        }
    }
    flag=0;
    for(int j=0;j<w;j++){
        if(dp[0][j]==0){
            flag=1;
        }
        if(flag==1){
            dp[0][j]=0;
        }
    }
//    print_dp(h,w);
    for(int i=1;i<h;i++){
        for(int j=1;j<w;j++){
            if(dp[i][j]==0){
                continue;
            }
            dp[i][j]=(dp[i-1][j]+dp[i][j-1])%1000000007;
        }
    }
    printf("%ld\n",dp[h-1][w-1]);
    return 0;
}


Measured memory_bytes: 7936
a, b, n = map(int, input().split())
 
cand = []
 
def calc(n):
  return int(a*n/b)-a*int(n/b)
 
cand.append(calc(0))
cand.append(calc(1))
cand.append(calc(n))
cand.append(calc(max(0, n-1)))
cand.append(calc(max(0, b*(n//b) - 1)))
cand.append(calc(min(n, max(0, b-1))))

if b == 1:
  print(0)
else:
  print(max(cand))

Measured memory_bytes: 9208
#include <stdio.h>

int main(){
 int a, b, r, tmp;
 scanf("%d", &a);
 scanf("%d", &b);
 if(a < b){
   tmp = a;
   a = b;
   b = tmp;
  }

  r = a % b;
  while(r != 0){
    a = b;
    b = r;
    r = a % b;
  }
   printf("%d\n",b);
 return 0;
}



Measured memory_bytes: 2144
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define RFOR(i,k,n) for (int (i)=(n)-1; (i)>=(k); --(i))
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
using namespace std;
//static const int INF = 1e9;
//static const double PI = acos(-1.0);
//static const double EPS = 1e-10;
//static const int dx[8] = { 1, 1, 0,-1,-1,-1, 0, 1};
//static const int dy[8] = { 0, 1, 1, 1, 0,-1,-1,-1};
typedef vector<int> VI;
typedef vector<VI> VVI;
// vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  return s;
}

int main() {
  int A, B, C, D, E, F;
  cin >> A >> B >> C >> D >> E >> F;
  int f = F /100;
  VI dpWater(f + 1, 0);
  dpWater[0] = 1;
  int water[2] = { A, B };
  FOR(i, 1, 3) {
    FOR(j, 1, f + 1) {
      if(j >= water[i - 1]) {
        dpWater[j] = dpWater[j - water[i - 1]] || dpWater[j];
      }
    }
  }
  double maxC = 0;
  int ansTotal = A * 100, ansSugar = 0;
  FOR(k, 1, f + 1) {
    if(!dpWater[k]) { continue; }
    int limit = min(F - 100 * k, E * k);
    debug2(k,limit);

    VI dpSugar(limit + 1, 0);
    dpSugar[0] = 1;
    int sugar[2] = { C, D };
    FOR(i, 1, 3) {
      FOR(j, 1, limit + 1) {
        if(j >= sugar[i - 1]) {
          dpSugar[j] = dpSugar[j - sugar[i - 1]] || dpSugar[j];
        }
      }
    }

    RREP(i, limit + 1) {
      if(dpSugar[i]) {
        double concentration = 100.0 * i / (100.0 * k + i);
        debug2(i,100 * k + i);debug(concentration);
        if(concentration > maxC) {
          maxC = concentration;
          ansTotal = 100 * k + i;
          ansSugar = i;
        }
        break;
      }
    }
  }

  cout << ansTotal << ' ' << ansSugar << endl;
  return 0;
}


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

#define ll long long int
#define vll vector<ll>
#define vllv vector<vector<ll>> 
#define vpii vector<pair<ll,ll>>
#define sz size()
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll MOD=1000000000+7;
ll ceil1(ll n,ll m){if(n%m==0){return n/m;}return n/m +1;}
ll factor(ll n){
    vll ans;
	if(n==2)ans.pb(2);
	else
    {for(ll i=2;i*i<=n;i++){if(n%i==0 && n%i!=i){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}ans.pb(n);}
    return ans.sz+1;
}
ll fact(ll n){ll res = 1;for (ll i = 2; i <= n; i++)res = res * i; 
    return res; } 
  
ll nCr(ll n, ll r){ return fact(n) / (fact(r) * fact(n - r)); } 
  
void dfs(vllv &v,ll k,vll &par,vll &dis,ll p)
{
    par[k]=p;
    dis[k]=dis[p]+1;
    for(ll i=0;i<v[k].sz;i++){
        if(v[k][i]!=p){
            dfs(v,v[k][i],par,dis,k);
        }
    }
}
bool sortbysec(const pair<string,int> &a,const pair<string,int> &b){return (a.second<b.second);} 

ll pow2(ll n,ll k){ll ans=1;
    while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;}
bool prime(int n){
    int i,j;
    for(i=2;i<=sqrt(n);i++){
        if(n%i==0){
            return false;
        }
    }
    return true;
}
bool bserch(vector<string> a, string s){
	ll l=0,r=a.sz-1,mid;
	while(l<=r){
		mid=(l+r)/2;
		if(a[mid]==s)return true;
		if(a[mid]<s){
			l=mid+1;
		}else{
			r=mid-1;
		}
	}
	return false;
}

bool sortcol(const vector<int>& v1, 
               const vector<int>& v2){ 
 return v1[0] < v2[0]; } 

 ll sumdegit(ll n)
 {
 	ll sum=0;
 	while(n>0)
 	{
 		sum+=(n%10);
 		n/=10; 	}
 		return sum;
 }

void solve()
{
	ll n;
	cin>>n;
	map<string,ll> mp;
	for(ll i=0;i<n;i++)
	{
		string s;
		cin>>s;
		mp[s]++;
	}
	cout<<"AC x "<<mp["AC"]<<endl;
	cout<<"WA x "<<mp["WA"]<<endl;
	cout<<"TLE x "<<mp["TLE"]<<endl;
	cout<<"RE x "<<mp["RE"];
	
	return;
}  
int main()
{
	fast;
    ll q;
    q=1;
    // cin>>q;
    while(q--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3684
#include<stdio.h>
int main()
{
	int n,m,a[10001]={0},b[10001]={0},i,j,yobu;
	while(1){
		int fla[501]={0},flb[501]={0},f;
		yobu=0,f=0;
		scanf("%d",&n);
		scanf("%d",&m);
		if(n==0 && m==0)break;
		for(i=0;i<m;i++){
			scanf("%d %d",&a[i],&b[i]);
			if(a[i]==1){
				fla[b[i]]=1,flb[b[i]]=1;
			}
		}
		for(i=0;i<m;i++){
			if(a[i]!=1){
				for(j=2;j<=n;j++){
					if(fla[j]==1 && fla[a[i]]==1)flb[b[i]]=1;
					if(fla[j]==1 && fla[b[i]]==1)flb[a[i]]=1;
				}
			}
		}
		for(i=2;i<=n;i++)if(flb[i]==1)++yobu;
		printf("%d\n",yobu);
	}
	return 0;
}


Measured memory_bytes: 1900
#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<cstring>
#include<map>
#include<set>
#include<cstdlib>
#include<bitset> 
using namespace std;
typedef long long ll;
ll f[1000004]={0};
int main(void)
{
	ll n;
	scanf("%lld",&n);
	for(ll x=1;x<=100;x++)
	{
		for(ll y=1;y<=100;y++)
		{
			for(ll z=1;z<=100;z++)
			{
				f[x*x+y*y+z*z+x*y+y*z+z*x]++;
			}
		}
	}
	for(ll i=1;i<=n;i++)
	{
		printf("%lld\n",f[i]);
	}
}

Measured memory_bytes: 4064
#  =========     /\       /|    |====/|
#      |        /  \       |    |   / |
#      |       /____\      |    |  /  |
#      |      /      \     |    | /   |
#  ========= /        \  =====  |/====|  
#  code

def main():
    a,b,c,k = map(int , input().split())
    s = 0
    s += min(a , k)
    k -= min(k , a)

    k -= min(k , b)

    s -= min(k , c)
    print(s)
    return

if __name__ == "__main__":
    main()

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

int main()
{
    int a,b,h,m;
    double hu,zi,kaku;
    double ans;
    cin>>a>>b>>h>>m;

    hu=m*6;
    zi=h*30+m/2.0;
    if(hu==0 || zi==0)kaku=360-fabs(hu-zi);
    else kaku=fabs(hu-zi);
    kaku=kaku*M_PI/180;
    ans=a*a+b*b-2*a*b*cos(kaku);
    ans=sqrt(ans);
    printf("%.10f\n",ans);
    return 0;
}

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

int main(){
  int N, a[100000], freq[100000];
  int ans = 0, count = 0;
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> a[i];
  }
  for(int i = 0; i < 100000; i++) freq[i] = 0;

  //頻度配列を作って、連続した3つの和、の最大値

  //頻度配列
  for(int i = 0; i < N; i++){
    freq[a[i]]++;
  }
  for(int i = 0; i+2 < 100000; i++){
    count = freq[i] + freq[i+1] + freq[i+2];
    if(ans < count) ans = count;
  }

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

Measured memory_bytes: 1024
import sys
input = sys.stdin.readline
from collections import *

N, P = map(int, input().split())
A = list(map(int, input().split()))
dp = [[0]*2 for _ in range(N+1)]
dp[0][0] = 1

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

print(dp[N][P])

Measured memory_bytes: 40624
#include <stdio.h>

int main(void)
{
    double k, a, b, i;
    double aa, bb;
    int c = 0;
    
    scanf("%lf", &k);
    scanf("%lf", &a);
    scanf("%lf", &b);

    aa = a / k;
    bb = b / k;

    for(i = 1; i <= 1000; i++){
      if(i >= aa && i <= bb){
        c = 1;
      }
    }

    if(c == 0){
      printf("NG\n");
    }
    else{
      printf("OK\n");
    }
    
    return 0;
}


Measured memory_bytes: 1632
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <map>
#include <ctime>
#include <list>
#include <bitset>
#include <algorithm>

#define ll long long
#define v vector
#define fo(i, c) for (int i = 0; i != c; i++)
#define fos(i, s, c) for (int i = s; i != c; i++)

using namespace std;

int main() 
{
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n, W;
	cin >> n >> W;
	v<int> w(n), u(n);
	fo(i, n)
		cin >> w[i] >> u[i];
	v<v<ll>> dp(n, v<ll>(++W, -W * 1e9));
	dp[0][w[0]] = u[0];
	fo(i, n)
		dp[i][0] = 0;
	fos(i, 1, n)
	{
		fo(j, W)
			dp[i][j] = dp[i - 1][j];
		fo(j, W - w[i])
			dp[i][j + w[i]] = max(dp[i][j + w[i]], dp[i - 1][j] + u[i]);
	}
	ll max;
	fo(i, W)
		max = std::max(max, dp[n - 1][i]);
	cout << max;
	return 0;
}

Measured memory_bytes: 79488
#include<stdio.h>
int main()
{
    int n,i,m,p,x,count,j,b;
    scanf("%d",&n);
    int a[n+2];
    for(i=0; i<n; i++)
    {
        scanf("%d",&a[i]);
    }
    scanf("%d",&m);
    for(i=0; i<m; i++)
    {
        scanf("%d%d",&p,&x);
         b=a[p-1];
        count=0;
        for(j=0; j<n; j++)
        {
            a[p-1]=x;
            count+=a[j];
        }
       a[p-1]=b;
        printf("%d\n",count);

    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>

int main() {
  long n, k;

  std::cin >> n;
  std::cin >> k;

  long ans=0;
  for (int b=k+1; b<n+1; b++) {
    ans += (b-k)*(n/b);

    if (k==0) {
      ans += n%b;
    } else if (n%b >= k-1) {
      ans += n%b-(k-1);
    }
  }

  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 256
import math
from functools import reduce
from itertools import product

def resolve():
  K = int(input())
  gcd = math.gcd
  step1 = [ gcd(x[0], x[1]) for x in product(range(1, K+1), range(1, K+1)) ]
  result = sum([ gcd(x[0], x[1]) for x in product(step1, range(1, K+1)) ])
  print(result)

if __name__ == "__main__":
    resolve()


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

#define FOR(i,start,end) for(int i=start; i<(int)(end); i++)
#define REP(i,n) FOR(i,0,n)
#define SIZE_OF_ARRAY(array)  (sizeof(array)/sizeof((array)[0]))

template<class T> void print(const T& value) { cout << value << "\n"; }

int main() {

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

    int x, y;
    scanf("%d %d", &x, &y);

    printf("%d %d\n", x * y, x*2 + y*2);


    return 0;
}



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

int main (void){

	int i=0;
	int number=0;
	int input[100000]={0};
	int count=0;
	int x=0;
	int flag=0;
	
	scanf("%d",&number);

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

	i=0;
	while(1){
		flag=0;
		for(x=1; x*x < input[i]; x++){
			if ( (input[i]-x) % (2*x+1) == 0){
				flag=1;
				break;
			}
		}
		
		if(flag){
			count++;
		}
		i++;

		if (i == number){
			break;
		}
	}

	printf("%d\n",number-count );

	return 0;
}

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

using namespace std;

#define MAX 100005
#define ll long long
int n;
string str;
vector<string> v;

void gen(int pos, string cur)
{
    if(pos == 3){
        v.push_back(cur);
        return;
    }
    for(int i=0; i<=9; i++){
        string temp = cur;
        temp += (char)((int)'0'+i);
        gen(pos+1, temp);
    }
}

string change(int n)
{
    string ret = "";
    while(n != 0){
        int mod = n%10;
        ret += (char)((int)'0'+mod);
        n = n/10;
    }
    reverse(ret.begin(), ret.end());
    return ret;
}

bool calc(string s)
{
    int it = 0;
    for(int i=0; i<str.length(); i++){
        if(it > 3) break;
        if(s[it] == str[i]) it++;
    }
    return (it>2);
}

int main()
{
    scanf("%d", &n);
    cin >> str;
    ll ans = 0;
    gen(0, "");
    for(int i=0; i<v.size(); i++){
        if(calc(v[i])) ans++;
    }
    cout << ans;
}

Measured memory_bytes: 384
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    niwa,ashi=parseMap(split(readline()))
    for tsuru in 0:niwa
        if tsuru*2+(niwa-tsuru)*4==ashi
            println("Yes")
            return
        end
    end
    println("No")
end
main()

Measured memory_bytes: 161960
n,ma,mb=map(int,input().split())
inf=10**4
A=[]
append=A.append
for i in range(n):
  a,b,c=map(int,input().split())
  append([a,b,c])
DP=[[[inf]*(10*n+1) for _ in range(10*n+1)] for _ in range(n+1)]
DP[0][0][0]=0
for i in range(n):
  a,b,c=A[i][0],A[i][1],A[i][2]
  for j in range(10*(i+1)+1):
    for k in range(10*(i+1)+1):
      if j>=a and k>=b:
        DP[i+1][j][k]=min(DP[i][j-a][k-b]+c,DP[i][j][k])
      else:
        DP[i+1][j][k]=DP[i][j][k]
ans=inf
for i in range(1,10*n+1):
  if i*mb%ma==0 and i*mb//ma<10*n+1:
    j=i*mb//ma
    ans=min(ans,DP[n][i][j])
print(ans if ans!=inf else -1)

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

using namespace std;

#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define endl "\n"
#define fff ff
#define sss ss.ff
#define ttt ss.ss
#define INF (1 << 30)
#define LLF (1ll << 60)
#define PRIME (1000000007)
#define FASTIO std::ios::sync_with_stdio(false)
#ifdef DEBUG
#define debug(x) cerr << #x << " = " << x << endl
#else
#define debug(x)
#endif
#define rep(i, begin, end)                            \
  for (__typeof(end) i = (begin) - ((begin) > (end)); \
       i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define FILE_INPUT                  \
  freopen("input.txt", "r", stdin); \
  freopen("output.txt", "w", stdout)

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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
typedef pair<ll, ii> iii;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<string> vs;

/*-----------------END TEMPLATE-----------------*/

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

  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      ll a = i, b = j;
      ll bit = 1;
      while ((a % 2) == (b % 2)) {
        a >>= 1;
        b >>= 1;
        bit++;
      }
      cout << bit << ' ';
    }
    cout << endl;
  }
}


Measured memory_bytes: 512
#!/usr/bin/env python3

stdin = open(0)
A, B, C = map(int, stdin.read().split())


def check(A, B, C):
    for _ in range(3):
        A, B, C = B, C, A
        if A == B != C:
            return True
    return False


answer = 'Yes' if check(A, B, C) else 'No'
print(answer)


Measured memory_bytes: 2940
// i_m_arin

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef priority_queue<ll> pqll;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef map<ll,ll> mpll;
typedef set<ll> stll;

#define f(i, a, n) 	for(ll i=a; i<(ll)n; i++)
#define f2(i, a, b) for(ll i=a; i<=(ll)b; i++)
#define pb 			push_back
#define ff 			first
#define ss 			second
#define pf			push_front
#define mp			make_pair
#define all(a)		(a).begin(),(a).end()
#define decimal(x)	fixed<<setprecision(x)
#define fsort(a)	sort(all(a))
#define rsort(a)	sort(all(a),greater<>())
#define fast_io		ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mem0(a)		memset(a,0,sizeof(a))
#define mem1(a)		memset(a,-1,sizeof(a))
#define lcm(a,b)	(a*b)/__gcd(a,b)
#define ub(v,x)		upper_bound(all(v),x)-v.begin()
#define lb(v,x)		lower_bound(all(v),x)-v.begin()

const ld PI  = acos(-1);
const ll MOD = 1e9+7;
const ll INF = LLONG_MAX;
const ll SIZE= 100000;


void solve(){
string s,t;
cin>>s>>t;
f(i,0,s.size()){
	if(s[i]!=t[i]){
		cout<<"No"<<endl;
		return;
	}
}
if(t.size()==s.size()+1){
	cout<<"Yes"<<endl;
}
else cout<<"No"<<endl;

}


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

Measured memory_bytes: 3588