akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		long[][] A = new long[N][2];
		for(int i=0;i<N;i++){
			A[i][0] = Integer.parseInt(sc.next());
			A[i][1] = Integer.parseInt(sc.next());
		}
		Arrays.sort(A, (a, b) -> Long.compare(a[0], b[0]));
		int needBuy = M;
		long ans = 0;
		int count = 0;
		while(needBuy > 0){
			if(needBuy <= A[count][1]){
				ans += needBuy*A[count][0]; 
				needBuy = 0;
			}
			if(needBuy > A[count][1]){
				ans += A[count][1]*A[count][0]; 
				needBuy -= A[count][1];
				count++;
			}
		}
		
		System.out.println(ans);
		sc.close();
	}
	

}


Measured memory_bytes: 64076
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <set>
#include <map>
#include<iostream>
#include<vector>
#define MAXN 20000
#define INF 0x3f3f3f3f
#include <algorithm>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int len=s.size();
    int x1,x2;
    int ans=0;
    if(len%2)x1=x2=len/2;
    else x1=len/2-1,x2=len/2;
    for(int i=x1,j=x2;i>=0&&j<len;i--,j++)
    {
        if(s[i]!=s[i+1]&&i!=j)break;
        if(s[i]==s[j])
        {

            if(i==j)ans++;
            else ans+=2;
        }
        else break;


    }
    //cout<<ans<<endl;
    cout<<(ans+len)/2;
}
///10100


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

int main(){
  int n,l;
  cin >> n >> l;
  int sum=n*(2*l+n-1)/2;
  if(l*(l+n-1)<=0){
    cout << sum << endl;
  }else if(l>0){
    cout << sum-l << endl;
  }else{
    cout << sum-l-n+1 << endl;
  }
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define ll long long
#define l long
#define ld long double
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pii pair<int,int>
using namespace std;
int main()
{
    fast;

    ld a,b;
    cin>>a>>b;
    a *= b;
    ll ans = a;
    cout<<ans;

}

Measured memory_bytes: 3748
def main():
  n = int(input())
  s = input()
  r = g = b = d =0
  for i in range(n):
    if s[i] == "R":
      r += 1
    elif s[i] == "G":
      g += 1
    else:
      b += 1
  a = r * g * b
  for i in range(n):
    for j in range(i+1,n):
      if s[i] == s[j]:
        continue
      k = 2*j - i
      if k >= n or s[k] == s[i] or s[k] == s[j]:
        continue
      d += 1
  print(a - d)
  
if __name__ == "__main__":
  main()

Measured memory_bytes: 9240
#include<cstring>
#include<cstdlib>
#include<cstdio>
using namespace std;

struct Node{
    int key;
    Node *prev,*next;
};

Node *nil;

Node* listSearch(int key){
    Node *cur=nil->next;
    while(cur!=nil && cur->key!=key){
        cur=cur->next;
    }
    return cur;
}

void init(){
    nil=(Node *)malloc(sizeof(Node));
    nil->next=nil;
    nil->prev=nil;
}

void printList(){
    Node *cur=nil->next;
    int i=0;
    while(true){
        if(cur==nil) break;
        if(i++>0) printf(" ");
        printf("%d",cur->key);
        cur=cur->next;
    }
    printf("\n");
}

void deleteNode(Node *t){
    if(t==nil) return;
    t->next->prev=t->prev;
    t->prev->next=t->next;
    free(t);
}

void deleteFirst(){
    deleteNode(nil->next);
}

void deleteLast(){
    deleteNode(nil->prev);
}

void Delete(int key){
    deleteNode(listSearch(key));
}

void insert(int key){
    Node *x=(Node *)malloc(sizeof(Node));
    x->key=key;
    x->next=nil->next;
    nil->next->prev=x;
    nil->next=x;
    x->prev=nil;
}

int main()
{
    int key,n;
    char com[20];
    scanf("%d",&n);
    init();
    for(int i=0;i<n;++i){
        scanf("%s",com);
        if(strlen(com)==6) scanf("%d",&key);
        if(com[0]=='i'){
            insert(key);
        }
        else if(com[0]=='d'){
            if(strlen(com)>6){
                if(com[6]=='F'){
                    deleteFirst();
                }
                else if(com[6]=='L'){
                    deleteLast();
                }
            }
            else{
                Delete(key);
            }
        }
    }
    printList();
    return 0;
}


Measured memory_bytes: 33972
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	ll n,x,y;
	cin >> n;
	vector<P> a(n);
	for(int i = 0; i < n; i++) {
		cin >> y >> x;
		a[i] = mp(x,y);
	}
	sort(ALL(a));//締切でソート

	int flag = 0;
	ll sum = 0;
	for(ll i = 0; i < n; i++) {
		sum += a[i].sc;
		if (sum > a[i].fs){
			flag = 1;
			break;
		}
	}
	if (flag == 0){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 3456
import scala.math._

// longでrangeの作り方

object Main extends App {

  val YES = "YES"
  val Yes = "Yes"
  val NO = "NO"
  val No = "No"
  ///////////////////////////////////////////

  val sc = new java.util.Scanner(System.in)
  val a, s, c = sc.next
//  val list = List.fill(3)(sc.next)

  val ans = "A" + s.head + "C"

  println(ans)


  ///////////////////////////////////////////

  def bigIterator(start: BigInt, end: BigInt, step: BigInt = 1) =
    Iterator.iterate(start)(_ + step).takeWhile(_ <= end)

  def lcm(a :Int, b :Int): Int =
    a / gcd(a, b) * b

  def lcm(a :Long, b :Long): Long =
    a / gcd(a, b) * b

  def gcd(a: Int, b: Int): Int =
    if (b == 0) a else gcd(b, a % b)

  def gcd(a: Long, b: Long): Long =
    if (b == 0) a else gcd(b, a % b)

  def setOrUpdated[A, B](a: Map[A, B], key: A, value: B, f: (B, B) => B) =
    a.get(key) match {
      case Some(v) => a.updated(key, f(value, v))
      case _ => a + (key -> value)
    }
}

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

a = list(set(A))

ans = "No"

if len(a) == 1:
    if a == [0]:
        ans = "Yes"
elif len(a) == 2:
    if N % 3 == 0 and A.count(0) == N//3:
        ans = "Yes"
elif len(a) == 3:
    if a[0] ^ a[1] == a[2] and N % 3 == 0 and A.count(a[0]) == A.count(a[1]) == N//3:
        ans = "Yes"

print(ans)

Measured memory_bytes: 14116
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b;
    cin>>a>>b;
    if(a>b){
        cout<<"a > b"<<endl;
    }
 if(a<b){
        cout<<"a < b"<<endl;
    }
    else if(a==b){
        cout<<"a == b"<<endl;
    }
   
    
    
    
    
        
}



Measured memory_bytes: 3108
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    string s;
    int ans = 0;
    cin >> s;
    if(s ==  "SSS") ans = 0;
    else if(s == "RRR") ans = 3;
    else if(s == "RRS" || s == "SRR") ans = 2;
    else ans = 1; 
    cout << ans << endl;
    return 0;
}

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

int main() {
    string s;
    int ans;
    cin >> s;
    ans = abs(753 - stoi(s.substr(0, 3)));
    for (int i = 1; i < s.length()-2; i++) {
        int sub_s = stoi(s.substr(i, 3));
        ans = min(ans, abs(753 - sub_s));
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
/**
 *   Author:  Wasi Ur Rahman
 *   FROM RMSTU
**/
#include <bits/stdc++.h>
#define ll         			long long
#define boost       		ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define min3(a,b,c)    		min(a,min(b,c))
#define min4(a,b,c,d)  		min(d,min3(a,b,c))
#define max3(a,b,c)    		max(a,max(b,c))
#define max4(a,b,c,d)  		max(d,max3(a,b,c))
#define all(v)         		v.begin(),v.end()
#define revall(v)      		v.rbegin(),v.rend()
#define pb             		push_back
#define eb             		emplace_back
#define setbits(x)     		__builtin_popcountll(x)
#define zrobits(x)     		__builtin_ctzll(x)
#define si(x)               scanf("%d", &x)
#define sii(x, y)           scanf("%d %d", &x, &y)
#define siii(x, y, z)       scanf("%d %d %d", &x, &y, &z)
#define siiii(p,x, y, z)    scanf("%d %d %d %d",&p, &x, &y, &z)
#define sll(x, y)           scanf("%lld %lld", &x, &y)
#define slll(x, y, z)       scanf("%lld %lld %lld", &x, &y, &z)
#define read                freopen("input.txt","r",stdin)
#define write               freopen("output.txt","w",stdout)
#define println()           cout << endl
#define printi(x)           printf("%d\n")
#define printii(x,y)        printf("%d %d\n")
#define printiii(x,y,z)     printf("%d %d %d\n")
#define printl(x)           printf("%lld\n")
#define printll(x,y)        printf("%lld %lld\n")
#define printlll(x,y,z)     printf("%lld %lld %lld\n") 
using namespace std;
/*************************************
**          A S S E M B L E         **
**************************************/
bool isPrime(ll n){if(n <= 1)return false;for (ll i = 2; i * i < n; i++)if (n % i == 0)return false;return true;}
ll fact(ll n){ll res = 1;for(ll i = n;i>=1;i--)res *= i;return res;}
ll nCr(ll n,ll r){return (fact(n)/(fact(r)*fact(n-r)));}
ll nPr(ll n,ll r){return fact(n)/fact(n-r);}
ll modpow(ll a, ll n, ll mod){ll res=1;while(n>0){if(n&1) res=res*a%mod;a=a*a%mod;n>>=1;}return res;}
const int mod=998244353;
inline int add(int a,int b){if((a+=b)>=mod)a-=mod;return a;}
inline int dec(int a,int b){if((a-=b)<0)a+=mod;return a;}
inline int mult(int a,int b){long long t=1ll*a*b;if(t>=mod)t%=mod;return t;}
inline int power(int a,int b){int out=1;while(b){if(b&1)out=mult(out,a);a=mult(a,a);b>>=1;}return out;}
/*************************************
**  E N D    G A M E   S T A R T S  **
**************************************/
int main(){
	boost;
	string a,b;
	cin >> a >> b;
	int cnt = 0;
	for(int i = 0;i<a.size();i++){
		if(a[i] != b[i])
			cnt++;
	}
	cout << cnt << endl;
}


Measured memory_bytes: 3752
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int n;
int a[105];
int Res(int x)
{
	int ret=0;
	for(int i=1;i<=n;i++)
		ret+=(a[i]-x)*(a[i]-x);
	return ret;
}
int main()
{
	int Min=0x3fffffff;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	for(int i=a[1];i<=a[n];i++)
		Min=min(Min,Res(i));
	printf("%d",Min);
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int H, W;
    while (cin >> H >> W) {
        if (H == 0 && W == 0) {
            break;
        }
        for (int i=0; i<H; ++i) {
            for (int j=0; j<W; ++j) {
                cout << (i==0 || i==H-1 || j==0 || j==W-1 ? "#" : ".");
            }
            cout << "\n";
        }
        cout << "\n";
    }

    return 0;
}

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


int main(){
  	int a,b;
  	string s;
  	cin >> a >> b >> s;
  
  	rep(i,0,s.size()){
      if((i < a && s[i] == '-') || (i > a && s[i] == '-')){
        cout << "No" << endl;
        return 0;
      }
      else if(i == a && s[i] != '-'){
        cout << "No" << endl;
        return 0;
      }
    }
  
  	cout << "Yes" << endl;
	return 0; 
}

Measured memory_bytes: 256
N = int(input())
T = [int(input()) for _ in range(N)]

def gcd(a, b):
	if not a % b:
		return b
	else:
		return gcd(b, a % b)

l = T[0]
for n in range(1, N):
	l = l * T[n] // gcd(l, T[n])

print(l)


Measured memory_bytes: 2940
import numpy as np


n = int(input())
a = np.array(list(map(int, input().split())))
# E = 0.5 * (np.eye(n) + np.eye(n, n, 1) + np.eye(n, n, -n + 1))
vec = (-1) ** np.arange(n)
b = np.zeros(n)
b[0] = np.dot(vec, a)
b[1] = np.dot(np.roll(vec, 1), a)
for i in range(2, n):
    sgn = (-1) ** (i % 2)
    b[i] = b[i - 2] - 2 * (a[i - 2] - a[i - 1])
print(' '.join([str(int(i)) for i in b]))

Measured memory_bytes: 23284
//agrawal117
//chahatagrawal117
#include<bits/stdc++.h>
#define endl '\n'
#define mod 1000000007
typedef long long int ll;
using namespace std;
#define MAX 100005
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll t;
	cin>>t;
  string s;
  cin>>s;
//   ll mid=s.size();
  if(t>=s.size()) {
    cout<<s<<endl; return 0 ; }
  else
  {
    for(int i=0;i<t;i++)
    {cout<<s[i];}
    cout<<"..."<<endl;
  }
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
void trace(int n, int arr[]){for(int i = 0; i < n; i++){cout << arr[i] << " ";} cout << endl << endl;}
int main()
{
    Hello
    int n;
    cin >> n;
    map<string, int> mp;
    for(int 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 0;
}

Measured memory_bytes: 3584
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<string.h>
#include<algorithm>
#include <cmath>
#include<map>

using namespace std;

long long i,j,k,n,m,N,M,ans,H[100000];

using Graph=vector<vector<long long>>;

Graph G;

int main()
{
  cin>>N>>M;
  for(i=0;i<N;i++)
  {
    cin>>H[i];
  }
  G.assign(N,vector<long long>());
  
  for(i=0;i<M;i++)
  {
    cin>>n>>m;
    n--;
    m--;
    G[n].push_back(m);
    G[m].push_back(n);    
  }
  ans=0;
  for(i=0;i<N;i++)
  {
    n=0;
    for(auto u:G[i])
    {
      if(H[i]<=H[u])
      {
        n=1;
        break;
      }
    }
    if(n==0)
    {
      ans++;
    }
  }
  
  cout<<ans;
  
  
}

Measured memory_bytes: 9860
//2019.7.7 by ljz
#include<bits/stdc++.h>
using namespace std;
#define res register int
#define LL long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f
#define eps 1e-12
#define RG register
#define db double
#define pc(x) __builtin_popcount(x)
typedef pair<int,int> Pair;
#define mp make_pair
#define fi first
#define se second
#define pi acos(-1.0)
#define pb push_back
#define gc getchar
//inline char gc() {
//    static char buf[100000],*p1,*p2;
//    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
//}
//inline int read() {
//    res s=0,ch=gc();
//    while(ch<'0'||ch>'9')ch=gc();
//    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
//    return s;
//}
inline int read() {
    res s=0,ch=gc(),w=1;
    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=gc();}
    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
    return s*w;
}
inline LL Read() {
    RG LL s=0;
    res ch=gc();
    while(ch<'0'||ch>'9')ch=gc();
    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
    return s;
}
//inline LL Read() {
//    RG LL s=0;
//    res ch=gc(),w=1;
//    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=gc();}
//    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
//    return s*w;
//}
inline void swap(res &x,res &y) {
    x^=y^=x^=y;
}
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N=1e5+10;
namespace MAIN{
    int n;
    LL a[N],A[N];
    inline void MAIN(){
        n=read();
        for(res i=1;i<=n;i++)a[i]=read();
        for(res i=n;i;i--)A[1]+=(i&1?1:-1)*a[i];
        for(res i=1;i<n;i++)A[i+1]=2*a[i]-A[i];
        for(res i=1;i<=n;i++)printf("%lld ",A[i]);
        puts("");
    }
}
int main() {
//    srand((unsigned)time(NULL));
    // freopen("zao.in","r",stdin);
    // freopen("std.out","w",stdout);
    MAIN::MAIN();
    return 0;
}

Measured memory_bytes: 2816
list1 = input().split(' ')
list1 = list(map(int, list1))
a = list1[0]
b = list1[1]
c = list1[2]

divisor = []
answer = []

for index in range(0, c):
    index += 1
    if c % index == 0:
        divisor.append(index)

for test_digit in range(a, b + 1):
    if test_digit in divisor:
        answer.append(test_digit)

print(len(answer))

Measured memory_bytes: 7684
import java.util.Scanner;

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

		if (H % A == 0) {
			System.out.println(H / A);
		} else {
			System.out.println(H / A + 1);
		}
	}
}

Measured memory_bytes: 21972
#include<functional>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<string>
#include<math.h>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
using namespace std;
const double INF=100000000;
 
int main(){
  int n,m;
  cin>>n>>m;
  int dp[n][n];
 
  rep(i,n){
    rep(j,n){
      dp[i][j]=i==j?0:INF;
    }
  }
  rep(i,m){
    int a,b,c,d;
    char e;
    cin>>a>>e>>b>>e>>c>>e>>d;
    dp[a-1][b-1]=c;
    dp[b-1][a-1]=d;
  }
  int s,g,V,P;
  char e;
  cin>>s>>e>>g>>e>>V>>e>>P;
 
  rep(k,n){
    rep(i,n){
      rep(j,n){
    dp[i][j]=min(dp[i][j],dp[i][k]+dp[k][j]);
      }
    }
  }
   
   
  cout<<V-P-dp[s-1][g-1]-dp[g-1][s-1]<<endl;
   
   
  return 0;
}
     

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

const int MOD = 1e9 + 7, MAX_N = 1e5;
int N, M;
ll x[MAX_N], y[MAX_N];

int main(){
    cin >> N >> M;
    for(int i=0;i<N;i++) cin >> x[i];
    for(int i=0;i<M;i++) cin >> y[i];

    ll sum_x = 0, sum_y = 0;
    for(int i=0;i<N;i++){
        sum_x += i * x[i] - (N-i-1) * x[i];
        sum_x %= MOD;
    }
    for(int i=0;i<M;i++){
        sum_y += i * y[i] - (M-i-1) * y[i];
        sum_y %= MOD;
    }

    cout << sum_x * sum_y % MOD << endl;
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main(){
  int h1,h2,s1,s2,m1,m2,H,S,M;
  int t=0;
  while(1){
    if(t>=3){
      break;
    }
    cin >> h1 >> s1 >> m1 >> h2 >> s2 >> m2;
    if(m2-m1<0){
      s2--;
      if(s2-s1<0){
	h2--;
	s2+=60;
      }
      m2+=60;
    }
    if(s2-s1<0){
      h2--;
      s2+=60;
    }
    H=h2-h1;
    S=s2-s1;
    M=m2-m1;
    cout << H << " " << S << " " << M << endl;
    t++;
  }
  /*for(int i=0;i<3;i++){
    cout << H[i] << " "  << S[i] << " " << M[i] << endl;
    }*/
}

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


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

    int l, i = 0;
    vector<double> vec(n);
    //
    for (int i = 0; i < n; i++) {
        cin >> vec.at(i);
    }

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

    double total = (vec.at(0) + vec.at(1))/2;
    for (int i=2;i<n;i++){
        total = (total + vec.at(i))/2;
    }

    cout << total;

/*
    std::cout << n << std::endl;
    for (int i=0;i<n;i++){
        std::cout << vec.at(i) << std::endl;
    }
*/
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const int N = 5 + 1e5; int n  , arr[N] , dp[N];
int calc(int p){
    if (p >= n) return 1e9;
    if (p == n - 1) return 0;
    if (dp[p] != -1) return dp[p];
    int one = calc(p + 1) + abs(arr[p] - arr[p + 1]);
    int two = calc(p + 2) + abs(arr[p] - arr[p + 2]);
    return dp[p] =  min(one , two);
}
int main() { fastIO
    cin >> n;
    memset(dp , -1 , sizeof dp);
    for (int i = 0 ; i < n ; i++)
        cin >> arr[i];
    cout << calc(0);
}


Measured memory_bytes: 10624
n,m,x=map(int,input().split())
a = [list(map(int,input().split())) for _ in range(n)]
import itertools
Cal2 = []
for i in range(1,n+1):
    C = list(itertools.combinations(a,i))
    Cal=[0]*len(C)
    for k in range(len(C)):
        ch=[0]*m
        for l in range(i):
            for j in range(1,m+1):
                ch[j-1]+=C[k][l][j]
            else:
                Cal[k] += C[k][l][0]
        else:
            if min(ch)>=x:
                Cal2.append(Cal[k])
if len(Cal2)==0:
    print(-1)
else:
    print(min(Cal2))

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

int main(int argc, char const *argv[])
{
    int n, a[200010];cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a, a+n);
    for (int i = 0; i < n-1; i++)
    {
        if (a[i] == a[i+1])
        {
            cout << "NO" << endl;
            return 0;
        }
        
    }
    cout << "YES" << endl;
    
    return 0;
}


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

const int nmax=8;
bool graph[nmax][nmax];

int dfs(int v,int N,bool visited[nmax]){
	bool all_visited=true;
	for(int i=0;i<N;i++){
		if(visited[i]==false)all_visited=false;
	}
	if(all_visited){return 1;}
	int ret=0;
	for(int i=0;i<N;i++){
		if(graph[v][i]==false)continue;
		if(visited[i])continue;
		visited[i]=true;
		ret+=dfs(i,N,visited);
		visited[i]=false;
	}
	return ret;
}

int main(){
	int N,M;
	cin>>N>>M;
	for(int i=0;i<M;i++){
		int A,B;
		cin>>A>>B;
		graph[A-1][B-1]=graph[B-1][A-1]=true;
	}
	bool visited[nmax];
	for(int i=0;i<N;i++)visited[i]=false;
	visited[0]=true;
	cout<<dfs(0,N,visited)<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main() {
  int n, i;
  int p[100010];
  scanf("%d", &n);
  for (i = 1; i < n+1; i++) {
    scanf("%d", &p[i]);
  }
  int count = 0;
  for (i = 1; i < n+1; i++) {
    if (p[i] == i) {
      int oldpi = p[i];
      p[i] = p[i+1];
      p[i+1] = oldpi;
      count += 1;
    }
  }
  printf("%d", count);
  return 0;
}


Measured memory_bytes: 512
package main
  
import (
    "fmt"
)

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

    var sum, ma int
    var am = int(1e9)
    for i := 0; i < n; i++ {
        a := l + i
        if abs(a) < am {
            am = abs(a)
            ma = a
        }
        sum += a
    }

    fmt.Println(sum - ma)
}

func abs(n int) int {
    if n < 0 {
        return -n
    }
    return n
}


Measured memory_bytes: 512
#!/usr/bin python3
# -*- coding: utf-8 -*-

def main():
    N, M = map(int, input().split())
    a = set([int(input()) for i in range(M)])
    mod = 10**9+7
    #dp[i]　iの位置に到達する最小の値
    dp = [0]*(N+1)
    dp[0] = 1
    for i in range(N):
        if (i+1)<=N and (not i+1 in a):
            dp[i+1] += dp[i]
            dp[i+1] %= mod
        if (i+2)<=N and (not i+2 in a):
            dp[i+2] += dp[i]
            dp[i+2] %= mod

    print(dp[N])

if __name__ == '__main__':
    main()

Measured memory_bytes: 13216
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;


void solve(long long H, long long N, std::vector<long long> A, std::vector<long long> B){
    ll NJ = 20001;
    vector<vll> dp(N+1, vll(NJ));
    REP(j, NJ){
        dp[0][j] = INF;
    }
    dp[0][0] = 0;
    REP(i, N){
        REP(j, NJ){
            if(j < A[i]){
                dp[i+1][j] = dp[i][j];
            }
            else{
                dp[i+1][j] = min(dp[i][j], dp[i+1][j-A[i]] + B[i]);
            }
        }
    }
    ll res = INF;
    
    for(ll j = H; j < NJ; j++){
        res = min(res, dp[N][j]);    
    }
    cout<< res<<endl;
}

int main(){
    long long H;
    scanf("%lld",&H);
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    std::vector<long long> B(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
        scanf("%lld",&B[i]);
    }
    solve(H, N, std::move(A), std::move(B));
    return 0;
}


Measured memory_bytes: 160640
import math


def main():
    # 入力
    n = int(input())
    elements = [int(input()) for i in range(n)]
    count = 0

    for element in elements:
        if prime_num(element) == True:
            count += 1

    print(count)


def prime_num(element):
    if element == 2:
        return True
    elif element < 1 or element % 2 == 0:
        return False
    else:
        p = 3
        while p <= math.sqrt(element):
            if element % p == 0:
                return False
            p += 2
        return True


if __name__ == '__main__':
    main()



Measured memory_bytes: 6016
/**
     *      ABC 109 A
     *      author  : kyomukyomupurin
     *      created : 
    **/
     
    #include <bits/stdc++.h>
    using namespace std;
     
    int main(){
        ios::sync_with_stdio(false);
        cin.tie(0);
     
        int A, B; cin >> A >> B;
        ((A * B) % 2 == 1) ? cout << "Yes" : cout << "No";
             
        return 0;
    }

Measured memory_bytes: 384
# utf-8:
import numpy as np


def main():
    n = int(raw_input())
    l1 = 2
    l2 = 1
    l3 = 1

    if n != 1:
        for _ in range(n - 1):
            l3 = luca(l1, l2)
            l1 = l2
            l2 = l3

    print(l3)


def luca(l1, l2):
    return l1 + l2


if __name__ == '__main__':
    main()


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

template<typename T>
T get_value(std::istream& is);

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

  vector<string> v(get_value<size_t>(cin));
  cin.ignore(numeric_limits<streamsize>::max(), '\n');
  for (auto& e: v)
    cin >> e;
  sort(v.begin(), v.end());

  for (const auto& e : v)
    cout << e;
  cout << '\n';
  return 0;
}

template<typename T>
inline T get_value(std::istream& is)
{
  T v;
  is >> v;
  return v;
}


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

int main(){
    int N;
    int L;
    cin >> N >> L;
    vector<string> S(N);
    for (int i = 0; i < N;i++)
    {
        cin >> S[i];
    }
    sort(S.begin(),S.end());
    for (int i = 0; i < N; i++)
    {
        cout << S[i];
    }
    cout << endl;
}

Measured memory_bytes: 256
import sys
def main():
    n, q = map(int, sys.stdin.readline().split())
    s = sys.stdin.readline().rstrip()
    lr = map(int, sys.stdin.read().split())
    lr = list(zip(lr, lr))

    cumsum = [None] * (n + 1)
    cumsum[0] = 0

    flag = False
    for i in range(n):
        t = s[i]
        if t == 'A':
            flag = True
            cumsum[i+1] = cumsum[i]
        else:
            if t == 'C' and flag:
                cumsum[i+1] = cumsum[i] + 1
            else:
                cumsum[i+1] = cumsum[i]
            flag = False

    for l, r in lr:
        res = cumsum[r] - cumsum[l]
        print(res)

if __name__ == "__main__":
    main()

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

typedef long long ll;

static const int MAX = 1e6;
static const int NIL = -1;
static const ll INF = 1<<21;
static const ll MOD = 1e9 + 7;

bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) {
    return arg1.first > arg2.first;
}

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

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

    for(int i=0;i<N;i++) {
        if(a.at(i)%2==0) {
            if(a.at(i)%3==0||a.at(i)%5==0) {
                ;
            }
            else { 
                cout << "DENIED" << endl;
                return 0;
            }
        }
        else continue;
    }

    cout << "APPROVED" << endl;

    return 0;
}


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

using namespace std;
using ll = long long;

const int INF = 1e9;
const double PI = acos(-1.0);
const ll MOD = 1e9 + 7;

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << #x << ": " << x << endl;
#define popcnt __builtin_popcount


int main() {
    ll K, A, B;
    cin>>K>>A>>B;
    if(B-A<=2){
        cout<<K+1<<endl;
        return 0;
    }

    ll cookies = 1, rest=K;
    while(1){
        if(cookies>=A){
            cookies+=(B-A)*(rest/2)+rest%2;
            cout<<cookies<<endl;
            return 0;
        }else{
            if(A+1>K){
                cout<<K+1<<endl;
                return 0;
            }else{
                cookies+=A-1;
                rest-=A-1;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 256
import numpy as np
N = int(input())
B = np.array(input().split(), dtype=int)[::-1]

ret = 0

ret += B[0]

i = 0
while i < N-2:
    ret += B[i] if B[i] < B[i+1] else B[i+1]
    i+=1

ret += B[-1]
print(ret)

Measured memory_bytes: 12392
import math
x = 0
a = int(input())
for _ in range(a):
    n = int(input())
    if n == 1:
        x = x + 1
        continue
    for i in range(2,int(math.sqrt(n))+1):
        if n % i == 0:
            x = x + 1
            break
print(a-x)


Measured memory_bytes: 5672
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;

int main(){
    ll A,B,C;
    cin >> A >> B >> C;
    
    if(A < C && C < B)
        cout << "Yes" << "\n";
    else if(B < C && C < A)
        cout << "Yes" << "\n";
    else
        cout << "No" << "\n";
    return 0;
} 


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

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

int main()
{
    //freopen("input.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, r;
    cin >> n >> r;
    cout << r + max(0, 100 * (10 - n));

    return 0;
}


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

#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define mem(x,val) memset((x),(val),sizeof(x))
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define PI acos(-1.0) 
#define N 511

const int INF = 1 << 30 ;
typedef long long ll ;
typedef pair < int , int > pii ;

int a[N][N] , ans[N][N] ;

int main() {
  int n, m, q , u ,v ;
  scanf("%d %d %d" ,&n ,&m ,&q) ;

  for(int i = 1 ;i<=m ; i++){
    scanf("%d %d" ,&u, &v) ;
    a[u][v]++;
  }

  for(int i = 1 ;i<=n ; i++)
    ans[i][1] = a[i][1] ;
  for(int i =1 ;i<=n ;i++) {
    for(int j = 2 ; j<=n ; j++) {
      ans[i][j]+=(ans[i][j-1] + a[i][j]) ;
    }
  }

  for(int j = 1 ; j<=n ; j++) {
    for(int i = 2 ; i<=n ; i++) {
      ans[i][j]+=ans[i-1][j];
    }
  }

  while(q--) {
    scanf("%d %d" ,&u , &v) ;
    cout << ans[v][v] - ans[u-1][v] - ans[v][u-1] + ans[u-1][u-1] << endl ;
  }	

  return 0 ;
}



Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()
#define let auto const

template<typename... Types>
struct dynarr: std::vector<Types...> {
  using std::vector<Types...>::vector;
  using size_type = typename std::vector<Types...>::size_type;
  auto&& operator[](size_type i) { return this->at(i); }
  auto&& operator[](size_type i) const { return this->at(i); }
};

int main() {
  i64 N;
  cin >> N;
  vector<i64> A(N);
  vector<i64> B(N);
  rep(i,0,N) {
    cin >> A[i];
    B[A[i] - 1] = i + 1;
  }
  rep(i,0,N) {
    cout << B[i] << " \n"[i + 1 == N];
  }
}


Measured memory_bytes: 2432
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<queue>
#define int long long
#define mod (int)(1000000007)
using namespace std;
int test[213456]; string uiop[213456];
signed main() {
	int n, a, b = 0, c = 1234567890, ans = 0; string s, t; cin >> n;
	for (int h = 0; h < n; h++) {
		cin >> test[h];
	}
	sort(test, test + n);
	for (int h = 1; h < n; h++) {
		if (test[h - 1] == test[h]) {
			cout << "NO" << endl; return 0;
		}
	}
	cout << "YES" << endl;
}

Measured memory_bytes: 3456
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int[][] array = new int[3][3];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                array[i][j] = sc.nextInt();
            }
        }
        
        int old = 5000;
        int a = array[0][0];
        int b = array[0][1];
        int c = array[0][2];
        for (int i = 0; i < 2; i++) {
            int d = array[i+1][0] - a;
            int e = array[i+1][1] - b;
            int f = array[i+1][2] - c;
            
            if (d == e && e == f) {
                if (i == 1) {
                    System.out.println("Yes");
                    return;
                }
            } else {
                System.out.println("No");
                return;
            }
        }
    }
}


Measured memory_bytes: 21844
import math

a, b, h, m = map(int, input().split())

r = abs(((h * 60 + m) / 720) - (m / 60))
r = min(1-r, r) * math.pi * 2

ans = math.sqrt(a**2+b**2-2*a*b*math.cos(r))

print(ans)


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

const long long MOD=1000000007;

long long a[100100],b[100100];

main()
{
    long long n,m;
    long long suma=0;
    long long sumb=0;
    long long ans=0;
    scanf("%lld %lld",&n,&m);
    for(long long i=0;i<n;i++)
        scanf("%lld",&a[i]);
    for(long long i=0;i<m;i++)
        scanf("%lld",&b[i]);
    long long total=0;
    for(long long i=0;i<n;i++)
    {
        //printf("%lld\n",n*a[i]-suma);
        total+=(i)*a[i]-suma;
        total%=MOD;
        suma+=a[i];
        suma%=MOD;
    }
    long long total2=0;
    for(long long i=0;i<m;i++)
    {
        total2+=(i)*b[i]-sumb;
        total2%=MOD;
        sumb+=b[i];
        sumb%=MOD;
    }
    printf("%lld\n",(total*total2)%MOD);
}


Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main(){
  int a, b, c, d;
  
  cin >> a >> b >> c >> d;
  
  int min = a + c;
  if(a < b){
    min = a + c;
    if(min > a + d){
        cout << a + d << endl;
    } else {
        cout << min << endl;
    }
  }
  else {
      min = b + c;
      if(min > b + d){
          cout << b + d << endl;
      } else {
          cout << min << endl;
      }
  }
  
 return 0;
}


Measured memory_bytes: 256
n,m = map(int,input().split())
ac=[0 for i in range (n)]
wa=[0 for i in range (n)]
grid = []
for i in range(m):
    a,b = input().split()
    if  ac[int(a)-1] == 1:
        continue
    if b == 'AC':
        ac[int(a)-1] = 1
    elif b == 'WA':
        wa[int(a)-1] += 1
ac_con,wa_con = 0,0
for i in range(n):
    if ac[i] == 0:
        continue
    else:
        ac_con+=1
        wa_con+=wa[i]
print(ac_con,wa_con)

Measured memory_bytes: 4732
#include <iostream>
#define REP(i,k,n) for(int(i)=(k);(i)<(n);++(i))
using namespace std;
typedef long long ll;

int A,B,C;
ll K;

int main()
{
  cin >> A >> B >> C >> K;

  // (-1)^K * (A0 - B0)
  ll ans = A - B;
  if (K % 2 == 1) ans = - ans;

  cout << ans << endl;

  return 0;
}


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

int main()
{
    int n, count1=0, count2=0;
    cin >> n;
    string s1, s2;
    for(int i=0; i<n; ++i)
    {
        cin >> s1 >> s2;
        if(s1 > s2) count1 += 3;
        else if(s1 < s2) count2 += 3;
        else {
            count1++;
            count2++;
        }
    }
    cout << count1 << " " << count2 << endl;
}


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

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repd(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define forr(i,a,b) for(ll i=(a);i<=(b);i++)
#define ford(i,a,b) for(ll i=(a);i>=(b);i--)
#define all(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define size(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)



int main(void) {
    int N,i,j;
    cin >> N;
    int n[200899];
    int m[200899];
    for(i=0;i<N-1;++i){
       cin >> n[i];
      
    }
     for(i=0;i<N-1;++i){
     
       m[n[i]-1]++;
    }
    for (j=0;j<N;++j){
        
         cout << m[j] << "\n";
    

    }   
    
  return 0;
}

Measured memory_bytes: 5152
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int dx[4] = { 0, -1, 1, 0 };
const int dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}

template<class T1, class T2> void chmin(T1 &a, T2 b) { if (a>b)a = b; }

template<class T1, class T2> void chmax(T1 &a, T2 b) { if (a<b)a = b; }
template<class T>
void Add(T &a, const T &b, const T &mod = 1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}
////////////////////////////////////////

int main() {
	int N, K;
	cin >> N >> K;
	string S;
	cin >> S;
	vector<int>sum;
	if (S[0] == '0')sum.push_back(0);
	for (int i = 0; i < N;) {
		int j = i;
		while (j < S.size() && S[j] == S[i]) {
			j++;
		}
		sum.push_back(j - i);
		i = j;
	}
	if (S.back() == '0')sum.push_back(0);
	vector<int>fuck(sum.size() + 1, 0);
	for (int i = 0; i < sum.size(); ++i) {
		fuck[i + 1] = fuck[i] + sum[i];
	}
	int res = 0;
	for (int left = 0; left < fuck.size(); left+=2) {
		int right = left + K * 2 + 1;
		if (right >= fuck.size())right = (int)fuck.size() - 1;
		res = max(res, fuck[right] - fuck[left]);
	}
	cout << res << endl;
	return 0;
}



Measured memory_bytes: 1272
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;
int main(){
  int n;
  string s;
  cin >>n >> s;

  int r_cnt = count(s.begin(), s.end(), 'R');
  string sub = s.substr(0, r_cnt);

  int w_cnt = count(sub.begin(), sub.end(), 'W');

  cout << w_cnt << endl;
  return 0;
}


Measured memory_bytes: 3896
#include <bits/stdc++.h>
#define ll long long
#define ls id << 1
#define rs id << 1 | 1
#define mem(array, value, size, type) memset(array, value, ((size) + 5) * sizeof(type))
#define memarray(array, value) memset(array, value, sizeof(array))
#define fillarray(array, value, begin, end) fill((array) + (begin), (array) + (end) + 1, value)
#define fillvector(v, value) fill((v).begin(), (v).end(), value)
#define pb(x) push_back(x)
#define st(x) (1LL << (x))
#define pii pair<int, int>
#define mp(a, b) make_pair((a), (b))
#define Flush fflush(stdout)
#define vecfirst (*vec.begin())
#define veclast (*vec.rbegin())
#define vecall(v) (v).begin(), (v).end()
#define vecupsort(v) (sort((v).begin(), (v).end()))
#define vecdownsort(v, type) (sort(vecall(v), greater<type>()))
#define veccmpsort(v, cmp) (sort(vecall(v), cmp))
using namespace std;
const int N = 1000050;
const int inf = 0x3f3f3f3f;
const ll llinf = 0x3f3f3f3f3f3f3f3f;
const int mod = 998244353;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
clock_t TIME__START, TIME__END;
void program_end()
{
#ifdef ONLINE
    printf("\n\nTime used: %.6lf(s)\n", ((double)TIME__END - TIME__START) / 1000);
    system("pause");
#endif
}
int n;
ll ans;
int vis[N], pri[N], tot;
void shaipri(int lim)
{
    for (int i = 2; i <= lim; ++i)
    {
        if (!vis[i])
            vis[i] = i, pri[++tot] = i;
        for (int j = 1; j <= tot && i * pri[j] <= lim; ++j)
        {
            vis[i * pri[j]] = pri[j];
            if (i % pri[j] == 0)
                break;
        }
    }
}

inline void solve()
{
    cin >> n;
    for (int c = 1; c < n; ++c)
    {
        ll now = n - c;
        ll tmp = 1;
        while (now > 1)
        {
            ll cnt = 1;
            int nowpri = vis[now];
            while (now % nowpri == 0)
                now /= nowpri, cnt++;
            tmp *= cnt;
        }
        ans += tmp;
    }
    cout << ans;
}

int main()
{
    TIME__START = clock();
    int Test = 1;
    shaipri(1000000);
    // scanf("%d", &Test);
    while (Test--)
    {
        solve();
        // if (Test)
        //     putchar('\n');
    }
    TIME__END = clock();
    program_end();
    return 0;
}

Measured memory_bytes: 7864
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String S = sc.next();
		int count = 0;
		char beforeS = S.charAt(0);

		for (int i = 1; i < N; i++) {
			char nowS = S.charAt(i);
			if (beforeS == nowS) {
				count++;
			}
			beforeS = nowS;
		}
		System.out.println(N - count);

		sc.close();
	}
}

Measured memory_bytes: 23764
n=int(input())
l=sorted(list(map(int,input().split())),reverse=True)
ans=0
for c in range(n-2):
    for b in range(c+1,n-1):
        flag=0
        if l[c]-l[b]+1>l[b+1]:
            flag=1
        elif l[c]-l[b]+1<=l[n-1]:
            ans+=(n-1-b)
            flag=1
        m=n-1
        h=b+1
        while flag!=1:
            x=(h+m)//2
            bef=x
            if l[x]>l[c]-l[b]+1:
                h=x
                x=(m+h)//2
            elif l[x]<l[c]-l[b]+1:
                m=x
                x=(m+h)//2
            else:
                if x==n-1:
                    ans+=(x-b)
                    break
                if l[x+1]==l[c]-l[b]+1:
                    h=x
                    x=(m+h)//2
                else:
                    ans+=(x-b)
                    break
            if bef==x:
                ans+=(x-b)
                break
print(ans)


Measured memory_bytes: 46040
import java.util.*;
import java.io.*;
public class Main {
	public static void main(String[] args) throws IOException {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      	double n = Integer.parseInt(br.readLine());
      	System.out.println((n/3)*(n/3)*(n/3));
    }
}

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

using namespace std;

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

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

	vector<int> x(N+1);

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

	x[N] = X;

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

	vector<int> d(N);
	for (int i = 0; i < N; i++) {
		d[i] = x[i+1] - x[i];
	}

	int D = d[0];

	for (int i = 1; i < N; i++)
	{
		D = gcd(D, d[i]);
	}

	cout << D << endl;

}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){
  int l,a,b,c,d,ansj,ansm,max;
  cin >> l >> a >> b >> c >> d;
  ansj = a / c;
  if(a%c!=0) ansj++;
  ansm = b / d;
  if(b%d!=0) ansm++;
  if(ansj>=ansm) max = l - ansj;
  else max = l - ansm;
  cout << max << endl;
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;



int main() {
//    cout << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n;
    cin >> n;
    int nn = pow(2, n);
    int a[nn];
    for (int i = 0; i < nn; i++) {
        cin >> a[i];
    }

    sort(a, a + nn, greater<>());
    map<int, int> have, rem;
    have[a[0]]++;
    for (int i = 1; i < nn; i++) rem[a[i]]++;

    for (int sz = 1; sz <= nn / 2; sz *= 2) {
        vector<int> just;
        for (auto e : have) {
            int el = e.first;
            for (int i = 0; i < e.second; i++) {
                auto it = rem.lower_bound(el);
                if (it != rem.begin()) {
                    it--;
                    it->second--;
                    just.pb(it->first);
                    if (it->second == 0) rem.erase(it);
                }

                else {
                    cout << "No";
                    return 0;
                }
            }
        }

        for (int e : just) {
            have[e]++;
        }
    }
    
    cout << "Yes";

//    cout << (rem.empty() ? "Yes" : "No");

}


Measured memory_bytes: 14080
n,k = map(int,input().split())
d = {}
ans = 0

for i in range(18):
    d[i] = 0
l = [2**i for i in range(18)]

for i in range(1,n+1):
    kk = i
    c = 0
    while(kk < k):
        c += 1
        kk *= 2
    else:
        d[c] += 1
else:
    for ind,val in d.items():
        ans += val*((1/2)**ind)
    
    print(ans/n)
    

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
using namespace std;
 
int main(){
    
    string N;
    cin >> N;

    for(int i=0;i<=2;i++){
        if(N[i]=='1'){
            N[i]='9';
        }else if(N[i]=='9'){
            N[i]='1';
        }
    }

    cout << N << endl;

    return 0;
}

Measured memory_bytes: 256
/*....
     
 "Be not afraid of GROWING slowly, be afraid only of STANDING Still"
                                                                     
....*/
#include<bits/stdc++.h>
#define Abhi_921 ios_base::sync_with_stdio(false); cin.tie(NULL)
#define ll long long
#define ld long double
#define fi(i,j,n) for(int i=j;i<n;i++)
#define fd(i,j,n) for(int i=j;i>n;i--)
#define print(a,n) for(int i=0;i<n;i++){cout<<a[i]<<' ';}cout<<endl;
#define inp(a,n) for(int i=0;i<n;i++) cin>>a[i]
#define printe(v) for(auto &i:v){cout<<i<<' ';}cout<<endl;
#define deb(n1) cout<<n1<<endl;
#define pb push_back
#define eb emplace_back
#define vi vector<ll>
#define vll vector<pair<ll,ll>>
#define umap unordered_map<ll,ll>
using namespace std;
const long long mod=1e9+7;
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
Abhi_921;
int t;
t=1;
while(t--){
int n;
cin>>n;
ll a[n]={};
ll d[n]={};
fi(i,0,n) cin>>a[i];
ll sum=0;
fi(i,1,n){
    if(a[i-1]>a[i]) sum+=abs(a[i-1]-a[i]),a[i]=a[i-1];
}
cout<<sum<<endl;
}
return 0;
}

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

int main() {
	int n;cin>>n;
	string s;cin >> s;
	string out ="";
	for(int i=0;i<s.size();++i){
		char ele = s[i];
		int pos = (int)ele - (int)'A';
		int pos_mov = (pos+n)%26 + (int)'A';
		out += (char)pos_mov;
	}
	cout << out << endl;
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> a(n);
  ll rn=0,gn=0,bn=0;
  rep(i,n){
    if(s[i]=='R'){
      a[i]=0;
      rn++;
    }else if(s[i]=='G'){
      a[i]=2;
      gn++;
    }else{
      a[i]=3;
      bn++;
    }
  }
  
  ll miss=0;
  rep(i,n){
    for(int j=i+1;2*j-i<n;j++){
      if(a[i]+a[j]+a[2*j-i]==5){
        miss++;
      }
    }
  }
  cout << rn*gn*bn-miss;
  return 0;
}

Measured memory_bytes: 3632
def divisor(n): #約数の列挙
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
a,b,c=map(int,input().split())
yakusu=divisor(c)
sum=0
for i in yakusu:
    if a<=i and b>=i:
        sum+=1
print(sum)


Measured memory_bytes: 5600