akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define FOR(i,a,b)    for (int i=(a)  ;i<(b) ;i++)
#define RFOR(i,a,b)   for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)      for (int i=0    ;i<(n) ;i++)
#define RREP(i,n)     for (int i=(n)-1;i>=0  ;i--)
#define EACH(i,a,b)   for (int i=(a)  ;i<=(b);i++)
#define REACH(i,a,b)  for (int i=(b)  ;i>=(a);i--)
#define ALL(a)        (a).begin(),  (a).end()
#define RALL(a)       (a).rbegin(), (a).rend()

const int MOD = 1e9 + 7;
const int INF = 1 << 29;
const double EPS = 1e-10;

using ll = long long;
using P = pair<int,int>;
template<class T = int> using V = vector<T>;

template<class T> bool inline chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool inline chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T = int> T inline input() { T x; cin >> x; return (x); }
template<class T> void inline print(T& x) { cout << x << '\n'; }
#define debug(x) cerr << #x << ": " << x << endl;

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

  int n;
  cin >> n;
  vector<int> A(n);
  REP(i,n) cin >> A[i];

  sort(ALL(A));
  int ans_n = A[n-1];
  int ans_r = 0;
  REP(i,n-1) {
    if (abs(ans_n - 2*A[i]) < abs(ans_n - 2*ans_r)) {
      ans_r = A[i];
    }
  }

  cout << ans_n << ' ' << ans_r << endl;

  return 0;
}


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

int C[12];
int A[12][12];

int main(){
  int N, M, X;
  cin >> N >> M >> X;
  for(int i=0; i<N; i++){
    cin >> C[i];
    for(int j=0; j<M; j++){
      cin >> A[i][j];
    }
  }
  int ans = 10000000;
  for(int i=1; i<=(1<<N); i++){
    vector<int> S(M,0);
    int cost=0;
    for(int j=0; j<12; j++){
      if((i&(1<<j))){
        for(int k=0; k<12; k++){
          S[k]+=A[j][k];
        }
        cost += C[j];
      }
    }
    bool f=true;
    for(int i=0; i<M; i++){
      if(S[i]<X) f=false;
    }
    if(f) ans = min(ans, cost);
  }
  if(ans==10000000){
    cout << "-1" << endl;
    return 0;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3604
#include <stdio.h>
#include <string.h>
#define N 100000

struct Node{
  int parent;
  int left;
  int right;
};

int main(){
  
  int n,j,p,i,d,s,t,a,id,k;
  
  scanf("%d",&n);
  
  struct Node T[n];

  for(i=0;i<n;i++){
    T[i].right=T[i].left=T[i].parent=-1;
  }
  
  for(i=0;i<n;i++){
    scanf("%d",&id);
    scanf("%d",&k);
    for(j=0;j<k;j++){
      scanf("%d",&d);
      if(j==0){
	t=d;
	T[id].left=t;
	T[d].parent=id;
      }
      else {
	T[t].right=d;
	T[d].parent=id;
	t=d;
      }
    }
  }


    for(i=0;i<n;i++){
      if(T[i].parent==-1){
	printf("node %d: parent = -1, depth = 0, root, [",i);
	a=T[i].left;
	while(a!=-1){
	  printf("%d",a);
	  a=T[a].right;
	  if(a!=-1){
	    printf(", ");
	  }
	}
	  printf("]\n");

      }
    
      else if(T[i].left==-1){
	s=0;
	printf("node %d: parent = %d, depth = ",i,T[i].parent);
	a=T[i].parent;
	while(a!=-1){
	  s++;
	  a=T[a].parent;
	    }
      
	printf("%d, leaf, []\n",s);
      }
    
      else{
	s=0;
	printf("node %d: parent = %d, depth = ",i,T[i].parent);
	a=T[i].parent;
	while(a!=-1){
	  s++;
	  a=T[a].parent;
	    }
      
	printf("%d, internal node, [",s);
	a=T[i].left;
	while(a!=-1){
	  printf("%d",a);
	  a=T[a].right;
	  if(a!=-1){
	    printf(", ");
	  }
	}
	  printf("]\n");

	
      }
    }
    return 0;
  }

Measured memory_bytes: 1788
#include<iostream>
using namespace std;
 
int main(){
    int n;
    int ans = 0;
    int a[24] = {0};
    int b[24] = {0};
    int c[24] = {0};

    cin >> n;

    for(int i = 0; i < n; i++){
            cin >> a[i];
    }
    for(int i = 0; i < n; i++){
            cin >> b[i];
            ans += b[i];
    }
    for(int i = 0; i < (n -1); i++){
            cin >> c[i];
    }
    for(int i = 0; i < (n-1); i++){
        if( (a[i] + 1)  == a[i+1] ){
            ans += c[a[i] - 1];
        }
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

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

int main() {
    int n;
    cin >> n;
    struct s{
        int id;
        int order;
    };
    vector
 a(n);
    rep(i, n){
        a[i].id = i;
        cin >> a[i].order;
    }
    sort(a.begin(), a.end(), [](const s& x, const s& y){return x.order < y.order;});
    rep(i,n){
        cout << a[i].id + 1;
        if(i+1 == n) cout << endl;
            else cout << " ";
    }
}


Measured memory_bytes: 1664
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define N_MAX 100
#define V_MAX 1000
#define INF INT_MAX
#define MOD (1000000007)

using namespace std;

typedef long long int Int;

Int dp[N_MAX+1][N_MAX*V_MAX+1];
Int w[N_MAX+1],v[N_MAX+1];

Int N,W;

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

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

    for(int i = 0;i < N;i++) {
        for(int j = 1;j <= N_MAX*V_MAX;j++) {
            dp[i][j] = INF;
        }
    }

    for(int i = 0;i < N;i++) {
        for(int j = 1;j <= N_MAX*V_MAX;j++) {
            if(j-v[i] >= 0)
                dp[i+1][j] = min(dp[i][j],dp[i][j-v[i]]+w[i]);
            else
                dp[i+1][j] = dp[i][j];
        }
    }

    Int sum = 0;
    for(Int i = 0;i <= N_MAX*V_MAX;i++) {
        if(dp[N][i] <= W)
            sum = max(sum,i);
    }

    cout<<sum<<endl;

    return 0;
}




Measured memory_bytes: 79104
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i >= (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl a,b,c,d;
    cin >> a >> b >> c >> d;
    cout << min(a,b) + min(c,d) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <map>
#include <utility>
#include <iomanip>
#include <queue>
#include <set>
#include <numeric>
#include <unordered_set>

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

using namespace std;


/*
int main(){
    int N;
    cin>>N;
    double A[N];
    for(int i=0;i<N;++i){
        cin>>A[i];
        cout<<fixed<<setprecision(9)<<A[i]<<endl;
    }
    
    cout<<"------------"<<endl;
    ll count=0;
    
    for(int i=0;i<N;++i){
        for(int j=i+1;j<N;++j){
            cout<<fixed<<setprecision(9)<<A[i]*A[j]<<endl;
            double tmp=A[i]*A[j];
            if(tmp==floor(tmp)){
                ++count;
            }
        }
    }
    
    cout<<count<<endl;
    
    
}

*/

ll gcd(ll a,ll b){
    while(true){
        b=b%a;
        //cout<<"b:"<<b<<endl;
        if(b==0){
            return a;
        }
        a=a%b;
         //cout<<"a:"<<a<<endl;
        if(a==0){
            return b;
        }
        
        

    }
 
}

ll lgd(ll a,ll b){
    return a*b/gcd(a,b);
}




int main(){
    ll A,B;
    cin>>A>>B;
    cout<<lgd(A,B)<<endl;
    
   
}



Measured memory_bytes: 3600
import java.util.*;
public class Main {
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);

      int a = sc.nextInt();
      int b = sc.nextInt();
     
      if((a*b)%2 == 0) {
        System.out.println("Even");
      } else {
        System.out.println("Odd");
      }
    
    }
}

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


int a,b,n,x,y;
queue<int>box;
int dontgo[50][50]={};
bool memo[50][50]={};


void Keiro(){
    
    cin >> n;
    
    for (int i=1;i<=n;i++){
        cin >>  x >> y;
        memo[x][y]=true;
    }
    
    dontgo[1][1]=1;
    for(int i=1;i<=a;i++){
        for(int t=1;t<=b;t++){
            
            if(memo[i][t]){
            }else{
                dontgo[i][t]=dontgo[i-1][t]+dontgo[i][t-1]+dontgo[i][t];
            }
        }
    }
    
    box.push(dontgo[a][b]);
    
    for(int i=0;i<=49;i++){
        for(int t=0;t<=49;t++){
            dontgo[i][t]={};
            memo[i][t]={};
        }
    }
}


int main(){
    int judge=1;
    
    
    
    
    while(judge==1){
        cin >> a >> b;
        if(a==0&&b==0){
            goto end;
        }
        Keiro();
    }
    

    
    
    end:
    
    int z;
    z=box.size();
    for(int i=0;i<=z-1;i++){
        cout << box.front() << endl;
        box.pop();
    }
    
    
    

    return 0;
}

Measured memory_bytes: 2960
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cstdint>
#include <cctype>
#include <cmath>
#include <tuple>
#include <cassert>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define mp(a,b) make_pair((a), (b))
#define mt(a,b,c) make_tuple((a),(b),(c))
#define MOD 1000000007;

typedef long long ll;



template <std::uint_fast64_t Modulus> class modint {
  using u64 = std::uint_fast64_t;

public:
  u64 a;

  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};

using mint = modint<1000000007>;


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

mint comb(ll n, ll a){
    mint fact = 1;
    for(int i=0;i<a;i++) fact = mint(n-i) * fact;
    for(int i=1;i<=a;i++) fact = fact / mint(i);
    return fact;
}

int main() {
    long long int n,a,b; cin >> n >> a >> b;
    mint pt = 1;
  pt = myPow(mint(2), n);
    cout << (pt - mint(1) - comb(n,a) - comb(n,b)).a << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
#define INF 1000000007
#define LINF 1000000000000000007
 
typedef long long i64;
typedef pair<i64,i64> P;


int a[3];

int main(){
	cin >> a[0] >> a[1] >> a[2];
	if(a[2] == a[1] && a[2] == a[0]) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

Measured memory_bytes: 256
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    String str;
    char[] ch, ch2;
    int i, j, n, m;

    for(;sc.hasNextLine();){
      str = sc.nextLine(); m = str.length();
      ch = new char[m]; ch2 = new char[m];
      for(i = 0;i < m;i++){
        ch[i] = str.charAt(i); ch2[i] = ch[i];
      }

      n = 0;
      for(i = 25;i >= 0;i--){
        for(j = 0;j < m;j++){
          if(ch[j] >= 'a' && ch[j] <= 'z'){
            ch2[j] = (char)((ch[j] + i) % ('z' + 1));
            if(ch2[j] < 'a')ch2[j] += 'a';
          }
        }
        for(j = 0;j < m - 3;j++){
          if(ch2[j] == 't' && ch2[j + 1] == 'h'
          && ch2[j + 2] == 'a' && ch2[j + 3] == 't'){
            n = 1;
            break;
          }else if(ch2[j] == 't' && ch2[j + 1] == 'h'
          && ch2[j + 2] == 'i' && ch2[j + 3] == 's'){
            n = 1;
            break;
          }else if(ch2[j] == 't' && ch2[j + 1] == 'h'
          && ch2[j + 2] == 'e'){
            n = 1;
            break;
          }else if(ch2[j + 1] == 't' && ch2[j + 2] == 'h'
          && ch2[j + 3] == 'e'){
            n = 1;
            break;
          }
        }
        if(n == 1)break;
      }

      for(j = 0;j < m;j++)out.print(ch2[j]);
      out.println();
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

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

int main() {
	string S;
	cin >> S;
	int ans = (int)1e9;
	int num100, num10, num1;

	for (int i = 0; i < S.size() - 2; i++) {
		num100 = (int)(S[i] - '0');
		num10 = (int)(S[i + 1] - '0');
		num1 = (int)(S[i + 2] - '0');
		int temp = num100 * 100 + num10 * 10 + num1;
		int now_ans = abs(753 - temp);
		ans = min(ans, now_ans);
	}

	cout << ans << endl;
	

	return 0;
}

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


int main()
{
  string s,t;
  cin>>s>>t;
  int S=s.size(),T=t.size();
  
  int dp[3100][3100]={0};
  
  for(int i=0;i<S;i++)
  {
    for(int j=0;j<T;j++)
    {
      if(s.at(i)==t.at(j))
        dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]+1);
      dp[i+1][j+1]=max(dp[i+1][j+1],max(dp[i+1][j],dp[i][j+1]));
    }
  }
  
  string str="";
  
  while(S>0&&T>0)
  {
    if(dp[S][T]==dp[S-1][T])
      S--;
    else if(dp[S][T]==dp[S][T-1])
      T--;
    else
    {
      str=s.at(S-1)+str;
      S--;
      T--;
    }
  }
  cout<<str<<endl;
}

Measured memory_bytes: 37760
#include <iostream>
#include <cmath>

#define SIZE 9

using namespace std;

void trace(int, int);

int main(void) {
	for (int i = 1; i <= SIZE; i++) {
		for (int j = 1; j <= SIZE; j++) {
			trace(i, j);
		}
	}
	return 0;
}

void trace(int a, int b) {
	cout << a << "x" << b << "=" << a*b << "\n";
}

Measured memory_bytes: 3020
#include<bits/stdc++.h>
using namespace std;
#define MP make_pair
#define x first
#define y second

const int Ni = 1e3 + 10;
const int Mi = 1e9 + 7;
const int INF = 0x3f3f3f3f;

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

int num[5];

int main()
{
	int n, a;
	scanf("%d", &n);
	memset(num, 0, sizeof(num));
	for(int i = 0; i < n; i++){
		scanf("%d", &a);
		if(!(a % 4)){
			num[4]++;
		}else if(!(a & 1)){
			num[2]++;
		}else num[1]++;
	}
	
	printf("%s\n", num[1] + !!(num[2]) - 2 >= num[4] ? "No" : "Yes");
	
	return 0;
}

Measured memory_bytes: 256
//============================================================================
// Name        : abc104.cpp
// Author      : sep
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cmath>
#include <ctime>
#include <functional>
#include <algorithm>
#include <vector>
#include <cctype>

using namespace std;

inline void main104A() {

	long int n;

	cin >> n;

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

}

inline void main104B() {

	string s;
	int temp;
	int i;

	cin >> s;

	if (s[0] != 'A') {
		cout << "WA";
		return;
	}

	if (((temp = s.find('C', 2)) > 0) && s.find('C', temp + 1) == string::npos
			&& temp < s.length() - 1) {

		s[0] = 'a';
		s[temp] = 'c';

		for (i = 0; i < s.length(); i++)
			if (islower(s[i]) == 0) {
				cout << "WA";
				return;
			}

		cout << "AC";
		return;

	} else {
		cout << "WA";
		return;
	}

	cout << "WA";

}

int main() {

#ifdef TEST
	struct timespec startTime, endTime;
	while (1) {
		clock_gettime(CLOCK_REALTIME, &startTime);
#endif

		main104B();

#ifdef TEST
		cout << flush;
		cerr << flush;
		cerr << endl << "Elapsed Time:";
		clock_gettime(CLOCK_REALTIME, &endTime);
		if (endTime.tv_nsec < startTime.tv_nsec) {
			cerr << endTime.tv_sec - startTime.tv_sec - 1 << "."
					<< endTime.tv_nsec + 1000000000 - startTime.tv_nsec << "s"
					<< endl;
		} else {
			cerr << endTime.tv_sec - startTime.tv_sec << "."
					<< endTime.tv_nsec - startTime.tv_nsec << "s" << endl;
		}

		cerr << endl;
	}
#endif

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int main(){
    int N;
    cin >> N;
    int A[N];
    int B[N];
    for(int i=0;i<N;i++) {
        cin >> A[i];
        B[A[i]-1] = i+1;
    }
    for(int i=0;i<N;i++){
        cout << B[i] << " ";
    }
    cout << endl;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int j=1;
    int ans =0;
    for(int i=0;i<n;i++){
        if(a[i] == j){
            j++;
        }
        else{
            ans++;
        }
    }
    if(ans==n){ans=-1;}
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define repr(i,a,n) for(ll i = n-1;i >= a;i--)
#define LINF (ll)1e17
#define INF (int)1e9
#define MOD (ll)1e9+7
#define sMOD 1e5
#define fs first
#define sc second

ll gcd(ll a,ll b){
	if(!b) return a;
	return gcd(b,a%b);
	
}

bool check(ll n){
	
	rep(i,1,500){
		if(pow(i,2) == n) return true;
	}
	
	return false;
}

signed main(){
	ll n,d,cnt = 0;
	ll memo = 0;
	cin >> n >> d;
	ll a[n][d] ={};
	
	rep(i,0,n){
		rep(j,0,d){
			cin >> a[i][j];
		}
	}
	
	rep(i,0,n-1){
		rep(j,i+1,n){
			memo = 0;
			rep(k,0,d){
				memo += pow(a[i][k] - a[j][k],2);
			}
			
			if(check(memo)) cnt++;
		}
	}
	
	cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

	Scanner sc=new Scanner(System.in);
	int a=sc.nextInt();
        int b=sc.nextInt();

        int mennseki=a*b;
	int shuu=2*a+2*b;
	
	System.out.println(mennseki +" "+ shuu);

    }
}

Measured memory_bytes: 25924
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority_queue
#include<deque>//double_ended queue
using namespace std;
typedef pair<int,int> P;//Pでpair<-,->を表す。
typedef long long LL; 
LL MOD=1000000007;
#include<iomanip>
 
int main()
{
    cout<<setprecision(15);
    LL l;
    cin>>l;
    l=l*l*l;
    double ans=l/27.0;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include<string.h>
using std::cout;
using std::cin;
using std::endl;

int main()
{
    std::string str;
    char alph[26]={0};
    int x;

    while (std::getline(cin, str))
    {
        for (int i = 0; i < str.size(); i++)
        {
            if (isalpha(str[i]))
            {
                if (isupper(str[i]))
                    str[i] = tolower(str[i]);
                x = str[i] - 'a';
                alph[x]++;
            }
        }
    }
        for (int i = 0; i < 26; i++)
        printf("%c : %d\n", 97+i, alph[i]);
    

    //cout<<str[0]<<":"<<str.size()<<endl;
    

    return 0;
}


Measured memory_bytes: 3340
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

class EulerTour{
    public:
	int cnt;
	vector<int> first,last,used;
	vector<vector<int> > g;
	EulerTour(int n) : g(n),first(n),last(n),used(n){}
	void add(int u, int v) {
		g[u].push_back(v);
		g[v].push_back(u);
	}
	void build(){
		cnt = 0;
		dfs(0);
	}
	void dfs(int v){
        used[v] = true;
		first[v] = cnt++;
		for(int to : g[v]){
			if(!used[to]) dfs(to);
		}
		last[v] = cnt++;
	}
	P get(int v){
		return mp(first[v],last[v]);
	}
};

class RSQ{
	int n,seg,init;
	vector<int> dat;
public:
	RSQ(int siz,int def) : n(siz),init(def),seg(1){
		while(seg < n) seg *= 2;
		dat.resize(seg * 2 - 1);
		for(int i = 0;i < seg * 2 - 1;i++) dat[i] = init;
	}
	void add(int i,int x){
		i += seg - 1;
		dat[i] = x;
		while(i){
			i = (i - 1) / 2;
			dat[i] = dat[i * 2 + 1] + dat[i * 2 + 2]; //do
		}
	}
	int get(int a = 0,int b = -1,int k = 0,int l = 0,int r = -1){
		if(b == -1) b = seg;
		if(r == -1) r = seg;
		if(b <= l || r <= a) return init;
		if(a <= l && r <= b) return dat[k];
		return get(a,b,k * 2 + 1,l,(l + r) / 2) + get(a,b,k * 2 + 2,(l + r) / 2,r); //do
	}
};

bool visited[100010];
int parEdge[100010];
map<P,int> edgeNum;

void dfs(int v,vector<vector<int>> &G){
    visited[v] = true;
    for(int to : G[v]){
        if(!visited[to]){
            parEdge[to] = edgeNum[P(v,to)];
            dfs(to,G);
        }
    }
}

signed main(){
	int n,m,out[100010] = {};
    cin >> n >> m;
    EulerTour euler(n);
    RSQ rsq(2 * n,0);
    vector<P> edges;
    for(int i = 0;i < n;i++) parEdge[i] = -1;
    for(int i = 0;i < m;i++){
        int a,b;
        cin >> a >> b; a--;b--;
        euler.add(a,b);
        edges.pb(P(a,b));
        edgeNum[P(a,b)] = i;
        edgeNum[P(b,a)] = i;
        out[a]++;
    }
    if(m % 2){
        cout << -1 << endl;
        return 0;
    }
    euler.build();
    dfs(0,euler.g);
    for(int i = 0;i < n;i++){
        if(out[i] % 2) rsq.add(euler.get(i).first,1);
    }
    for(int i = 0;i < n;i++){
        if(rsq.get(euler.get(i).first,euler.get(i).second) % 2 && parEdge[i] != -1){
            swap(edges[parEdge[i]].first,edges[parEdge[i]].second);
        }
    }
    for(int i = 0;i < m;i++){
        cout << edges[i].first + 1 << " " << edges[i].second + 1 << endl;
    }
}

Measured memory_bytes: 39920
from collections import defaultdict

n, m= map(int, input().split())

links = [[] for x in range(n + 1)]
sums = [0 for x in range(n + 1)]
adds = [0 for x in range(n + 1)]

links[0].append(1)
for _ in range(n - 1):
  a, b= map(int, input().split())
  links[a].append(b)
  links[b].append(a)

for _ in range(m):
  p, x = map(int, input().split())
  adds[p] += x

# print(links)
que = [0,[1]]
checked = [0 for x in range(n+1)]

que = [[-1, [0]]]

while que:
  link = que.pop()
  # print(link)
  par = link[0]
  childs = link[1]

  for child in childs:
    if checked[child] != 1:
      sums[child] = sums[par] + adds[child]
      que.append([child, links[child]])
      checked[child] = 1

  
print(*sums[1:])

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

int main(){
    int n,max=0,maxindex,sum=0;
    int L[20];
    cin >> n;
    for(int i=0;i<n;++i){
        cin >> L[i];
        if(L[i]>max){
            max = L[i];
            maxindex = i;
        }
    }

    for(int i=0;i<n;++i){
        if(i==maxindex){
            continue;
        }
        sum += L[i];
    }

    if(sum>max){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;

}

Measured memory_bytes: 256
# /usr/bin/python
# -*- coding: utf-8 -*-
#
import sys
import math


n,a,b = map(int, input().split())


ans = 0
for i in range(1,n+1):
  s = sum(list(map(int, list(str(i)))))
  if a <= s and s <= b:
    ans += i

print(ans)


Measured memory_bytes: 42092
#include <iostream>
#include <queue>
#define INF 1000000000
#define NV 100000
using namespace std;
class edge
{
  public:
  int t;
  int d;
  edge *nextedge;
  edge(int,int);
};

edge::edge(int tt,int dd)
{
  t=tt;
  d=dd;
  nextedge=NULL;
}

class vertice
{
  public:
  edge *firstedge;
  void create_edge(int,int);
};

void vertice::create_edge(int t,int d)
{
  edge *newedge=new edge(t,d);
  if(firstedge==NULL)
    firstedge=newedge;
  else
  {
    edge *tmp=firstedge;
    while(tmp->nextedge!=NULL)
    {
      tmp=tmp->nextedge;
    }
    tmp->nextedge=newedge;
  }
}

class source
{
  public:
  int n;
  int dis;
  friend bool operator<(source,source);
};

bool operator<(source a, source b)
{
  return a.dis>b.dis;
}

int main()
{
  int v,e,r;
  cin>>v>>e>>r;
  source weight[v];
  vertice vertices[v];
  for(int i=0;i<v;i++)
  {
    vertices[i].firstedge=NULL;
    weight[i].n=i;
    weight[i].dis=INF;
  }
  for(int i=0;i<e;i++)
  {
    int s,t,d;
    cin>>s>>t>>d;
    vertices[s].create_edge(t,d);
  }
  weight[r].dis=0;
  int current_vertex=r;
  priority_queue<source> queue;
  queue.push(weight[r]);
  while(queue.size()!=0)
  {
    source del=queue.top();
    queue.pop();
    current_vertex=del.n;
    edge *neighbor=vertices[current_vertex].firstedge;
    while(neighbor!=NULL)
    {
      int vn=neighbor->t;
      if(weight[vn].dis>weight[current_vertex].dis+neighbor->d)
      {
        weight[vn].dis=weight[current_vertex].dis+neighbor->d;
        queue.push(weight[vn]);
      }
      neighbor=neighbor->nextedge;
    }
  }
  for(int i=0;i<v;i++)
    if(weight[i].dis>=INF)
      cout<<"INF"<<endl;
    else
      cout<<weight[i].dis<<endl;
}

Measured memory_bytes: 20564
//*
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <functional>
#define MOD 1000000007
#define MAX 0x3f3f3f3f
#define MAX2 0x3f3f3f3f3f3f3f3fll
#define ERR 1e-10
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#pragma warning(disable:4996)
using namespace std;

typedef long long ll;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

int n, m, p;

int u1[300000], u2[300000];
vector<int> g[300000];
int ans[300000];

int find(int x, int u[])
{
	return u[x]==x?x:u[x]=find(u[x], u);
}

int main()
{
	int i, j, k, l;
	cin>>n>>m>>p;
	for(i=0;i<n;i++) u1[i]=u2[i]=i;
	for(i=0;i<m;i++)
	{
		int x, y;
		scanf("%d%d", &x, &y), x--, y--;
		u1[find(x, u1)]=find(y, u1);
	}
	for(i=0;i<p;i++)
	{
		int x, y;
		scanf("%d%d", &x, &y), x--, y--;
		u2[find(x, u2)]=find(y, u2);
	}
	for(i=0;i<n;i++) find(i, u1), find(i, u2), g[u1[i]].push_back(i);
	for(i=0;i<n;i++)
	{
		map<int, int> cnt;
		for(auto e : g[i]) cnt[u2[e]]++;
		for(auto e : g[i]) ans[e]=cnt[u2[e]];
	}
	for(i=0;i<n;i++) printf("%d ", ans[i]);
	cout<<endl;
	return 0;
}
//*/

Measured memory_bytes: 16376
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

#define M_PI       3.14159265358979323846

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int solve()
{
    int A, B, C;

    cin >> A >> B >> C;

    return std::max(0, C - (A - B));
}

int main()
{
    cout << solve() << endl;

    return 0;
}

Measured memory_bytes: 256
a='light ',require("fs").readFileSync("/dev/stdin","utf8").split(/\s/).map(function(i){i?console.log(i>91?'heavy':i>81?a+'heavy':i>75?'middle':i>69?a+'middle':i>64?'welter':i>60?a+'welter':i>57?'light':i>54?'feather':i>51?'bantam':i>48?'fly':a+'fly'):0})

Measured memory_bytes: 7644
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static java.lang.Integer.parseInt;

/**
 * The Number of Chairs
 * PCK2014 ??????1
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		words = br.readLine().split(" ");

		int d, c;
		d = parseInt(words[0]);
		c = parseInt(words[1]);

		System.out.println(d * c);
	}
}

Measured memory_bytes: 24284
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include<map>
#include<tuple>
using namespace std;
#define INF 11000000000
#define MAX 110000
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<pair<int,int>,int> p;
typedef pair< pair<int,int>, int> p; 
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)

int C[510][510],S[510][510];

int main(){
    int N,M,Q,p,q;
    cin>>N>>M>>Q;
    for(int i=0;i<M;i++){
        int a,b;
        cin>>a>>b;
        C[a][b]++;
    }
    for(int i=0;i<510;i++){
        for(int j=1;j<510;j++){
            S[i][j]+=S[i][j-1]+C[i][j];
        }
    }
    for(int i=0;i<Q;i++){
        cin>>p>>q;
        int ans=0;
        for(int j=p;j<=q;j++){
            ans+=S[j][q]-S[j][p-1];
        }
        cout<<ans<<endl;
    }
}



Measured memory_bytes: 2944
#include <iostream>
#include <string>
using namespace std;
long long NOD(int a, int b)
{
	while (a > 0 && b > 0)
		if (a > b)
			a %= b;
		else
			b %= a;
	return a + b;	
}
long long KK(long long a, long long b, long long c) {
	long long l, r, k;
	l = a - a % c;
	r = b - b % c;
	k = (r - l) / c - 1;
	if (l >= a) ++k;
	if (r <= b) ++k;
	return k;
}	
int main()
{
	long long a, b, c, d;
	cin >> a >> b >> c >> d;
	long long h = c * d / NOD(c, d);
	long long res = KK(a, b, c) + KK(a, b, d) - KK(a, b, h);
	cout << b - a + 1 - res;
	return 0;
}
/*
4 9 2 3
*/

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#define endl "\n"
using namespace std;

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

    int i, data;
    int sum = 0;
    for(i = 0; i < n; i ++)
    {
    	cin >> data;
    	sum += data;
    }

    if(h > sum)
    	cout << "No" << endl;
    else
    	cout << "Yes" << endl;
}

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

int main(){
  long N, B;
  std::cin >> N;
  B = N;
  int r = 2;
  if(N > 10000 * 10000){
    r = 10000;
    for(int i = 2; i <= 10000; i++){
      if(N % i == 0){
        B = N / i;
      }
    }
  }
  for(long i = std::sqrt(N); i <= N / r; i++){
    if(N % i == 0){
      B = i;
      break;
    }
  }
  int digit = 0;
  while(B > 0){
    B /= 10;
    digit++;
  }
  std::cout << digit << std::endl;
}

Measured memory_bytes: 256
h, w = map(int, input().split())
a = []
delcol = {i: True for i in range(w)}
for _ in range(h):
    _a = input()
    if _a == "."*w:
        continue

    for _w in range(w):
        delcol[_w] &= ("." == _a[_w])

    a.append(_a)

for _a in a:
    for _w in range(w):
        if not delcol[_w]:
            print(_a[_w], end="")

    print()



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

count = 0
ok = 0
for i in A:
    if i % 2 == 0:
        count += 1
        if i % 3 == 0 or i % 5 == 0:
            ok += 1

if count == ok:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 9076
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
string s;
int main(){
	cin>>n>>s;
	for(int i=0;i<s.size();i++){
		s[i]+=n;
		s[i]='A'+(s[i]-'A')%26;
	}
	cout<<s;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main(){
  int n;
  std::cin >> n;
  int cnt = 0;
  for(int i=1; i<=9; ++i)
    for(int j=1; j<=9; ++j)
      if(i*j == n)
        ++cnt;
  if(cnt>0)
    std::cout << "Yes" << std::endl;
  else
    std::cout << "No" << std::endl;
  return 0;
}

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

#define INIT_CAP 10
#define INF 1000000000

#define min(a, b) (((a) < (b)) ? (a) : (b))

const int di[4] = {-1, 0, 1, 0}, dj[4] = {0, 1, 0, -1};

typedef struct {int to, w;} Edge;
typedef struct {Edge *elem; int cap, size;} VecEdge;
typedef struct {int num, d;} PNumDis;

VecEdge adj[3600];
PNumDis heap[14400];
int hsize;
int d[3600];

void init(int n) {
	while (n--)
		adj[n] = (VecEdge){malloc(sizeof(Edge) * INIT_CAP), INIT_CAP, 0};
}

void add(int from, int to, int w) {
	if (adj[from].size == adj[from].cap) {
		adj[from].cap <<= 1;
		adj[from].elem = realloc(adj[from].elem, sizeof(Edge) * adj[from].cap);
	}
	adj[from].elem[adj[from].size++] = (Edge){to, w};
}

void freeAll(int n) {
	while (n--)
		free(adj[n].elem);
}

void insert(int num, int d) {
	int i;
	for (i = hsize++; i > 0 && d < heap[i - 1 >> 1].d; i = i - 1 >> 1)
		heap[i] = heap[i - 1 >> 1];
	heap[i] = (PNumDis){num, d};
}

int calcNextIdx(int i) {
	return i * 2 + 1 + (i * 2 + 2 < hsize && heap[i * 2 + 1].d > heap[i * 2 + 2].d);
}

PNumDis delete(void) {
	int i;
	int nextIdx;
	const PNumDis root = heap[0], last = heap[--hsize];

	for (i = 0; i * 2 + 1 < hsize && last.d > heap[nextIdx = calcNextIdx(i)].d; i = nextIdx)
		heap[i] = heap[nextIdx];
	heap[i] = last;

	return root;
}

void dijkstra(int n, int s) {
	int i;

	for (i = 0; i < n; i++)
		d[i] = INF;

	d[s] = 0;
	insert(s, 0);
	while (hsize > 0) {
		const PNumDis fromP = delete();

		if (fromP.d > d[fromP.num])
			continue;

		for (i = 0; i < adj[fromP.num].size; i++) {
			const Edge e = adj[fromP.num].elem[i];
			if (fromP.d + e.w < d[e.to]) {
				d[e.to] = fromP.d + e.w;
				insert(e.to, d[e.to]);
			}
		}
	}
}

int main(void) {
	int i, j, k, l;
	int w, h;

	while (scanf("%d %d", &w, &h), w) {
		int s[30][30];
		int c[4];

		for (i = 0; i < h; i++)
			for (j = 0; j < w; j++)
				scanf("%d", s[i] + j);

		for (i = 0; i < 4; i++)
			scanf("%d", c + i);

		init(h * w * 4);
		for (i = 0; i < h; i++)
			for (j = 0; j < w; j++)
				for (k = 0; k < 4; k++)
					for (l = 0; l < 4; l++) {
						int nd = k + l & 3;
						int ni = i + di[nd], nj = j + dj[nd];
						if (ni >= 0 && ni < h && nj >= 0 && nj < w)
							add(i * w * 4 + j * 4 + k, ni * w * 4 + nj * 4 + nd, l == s[i][j] ? 0 : c[l]);
					}

		dijkstra(h * w * 4, 1);

		printf("%d\n", min(d[(h - 1) * w * 4 + (w - 1) * 4 + 1], d[(h - 1) * w * 4 + (w - 1) * 4 + 2]));

		freeAll(h * w * 4);
	}

	return 0;
}

Measured memory_bytes: 1036
#include<bits/stdc++.h>
#define vi vector<int>
#define pb push_back
#define pii pair<int,int>
#define piii pair<int,pii>
#define F first
#define S second
#define mp make_pair
using namespace std;
const int N=1e5+5;
int fa[N][25],ans[N],n,Q,dep[N],d[N],cnt[N],sum[N];
vi v[N],col[N],len[N];
vector<piii> q[N];
void DFS(int now,int fat)
{
	fa[now][0]=fat;
	dep[now]=dep[fat]+1;
	for(int i=0;i<v[now].size();i++)
		if(fat!=v[now][i])
			d[v[now][i]]=d[now]+len[now][i],DFS(v[now][i],now);
}
int lca(int x,int y)
{
	if(dep[x]>dep[y])swap(x,y);
	for(int i=0;dep[x]<dep[y];i++)
		if(((dep[y]-dep[x])>>i)&1)
			y=fa[y][i];
	if(x==y)return x;
	for(int i=19;i>=0;i--)
		if(fa[x][i]!=fa[y][i])
			x=fa[x][i],y=fa[y][i];
	return fa[x][0];
}
void dfs(int now,int fat)
{
	for(int i=0;i<q[now].size();i++)
		if(q[now][i].F>0){
			ans[q[now][i].F]+=d[now]+cnt[q[now][i].S.F]*q[now][i].S.S-sum[q[now][i].S.F];
		}else{
			ans[-q[now][i].F]-=2*(d[now]+cnt[q[now][i].S.F]*q[now][i].S.S-sum[q[now][i].S.F]);
		}
	for(int i=0;i<v[now].size();i++)
	{
		int to=v[now][i];
		if(to==fat)continue;
		cnt[col[now][i]]++;
		sum[col[now][i]]+=len[now][i];
		dfs(to,now);///////
		cnt[col[now][i]]--;
		sum[col[now][i]]-=len[now][i];
	}
}
int main()
{
	cin>>n>>Q;
	for(int i=0;i<n-1;i++)
	{
		int a,b,c,d;
		cin>>a>>b>>c>>d;
		v[a].pb(b);
		v[b].pb(a);
		col[a].pb(c);
		col[b].pb(c);
		len[a].pb(d);
		len[b].pb(d);
	}
	DFS(1,0);
	for(int i=1;i<20;i++)
		for(int j=1;j<=n;j++)
			fa[j][i]=fa[fa[j][i-1]][i-1];
	for(int i=1;i<=Q;i++)
	{
		int a,b,x,y;
		cin>>a>>b>>x>>y;
		q[x].pb(mp(i,mp(a,b)));
		q[y].pb(mp(i,mp(a,b)));
		q[lca(x,y)].pb(mp(-i,mp(a,b)));
	}
	dfs(1,0);
	for(int i=1;i<=Q;i++)cout<<ans[i]<<"\n";
	return 0;
}

Measured memory_bytes: 42680
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    long b = 0;
    for(int i = 1; i <= a; i++) {
    	if(!(i % 3 == 0 || i % 5 == 0)) b += i;
    }
    System.out.println(b);
  }
}

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

#define ld long double
#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define IN freopen("input.txt","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(int i=a ; i<=b ; i++)
#define FORD(i,a,b) for(int i=a ; i>=b ; i--)
#define INF 1000000000
#define ll long long int
#define eps (1e-8)
#define sq(x) ( (x)*(x) )
#define all(x) x.begin(),x.end()
#define flog2(n) 64 - __builtin_clzll(n) - 1
#define popcnt(n) __builtin_popcountll(n)

using namespace std;

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

ld d[305][305][305]; 
int cnt[5];
int n;

ld calc (int i, int j, int k) {
	if (i < 0 || j < 0 || k < 0) return 0;

	if (d[i][j][k] != -1) return d[i][j][k];


	int sum = i + j + k;

	return d[i][j][k] = n * 1.0 / sum + calc(i, j + 1, k - 1) * k  * 1.0 / sum + calc(i + 1, j - 1, k) * j * 1.0 / sum + calc(i - 1, j, k) * i * 1.0 / sum;
}

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

    FOR (i, 1, n) {
    	int x;
    	cin >> x;
    	cnt[x]++;
    }


    FOR (i, 0, n) {
    	FOR (j, 0, n) {
    		FOR (k, 0, n) {
    			d[i][j][k] = -1;
    		}
    	}
    }

    d[0][0][0] = 0;

    cout << fixed << setprecision(11) <<  calc(cnt[1], cnt[2], cnt[3]) << endl;

    return 0;
}

Measured memory_bytes: 438528
#include <bits/stdc++.h>
using namespace std;
typedef pair<long long, long long> P;
#define int long long
#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#ifdef DEBUG
std::ostream& dout = cout;
#else
stringstream dout;
#endif
template<typename T, typename U>
istream& operator>>(istream& in, pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}
class BIT{
    vector<int> node;
    int size;
  public:
    BIT(int n){
        size=1;
        while(size<=n)size*=2;
        node.resize(size,0);
    }
    int sum(int i){
        int s=0;
        while(i>0){
            s+=node[i];
            i-=i&-i;
        }
        return s;
    }
    void add(int i,int x){
        while(i<=size){
            node[i]+=x;
            i+=i&-i;
        }
    }
};
signed main(signed argc, char* argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    const int MOD = 1000000007;
    int n,q;
    string s;
    cin>>n>>s>>q;
    vector<BIT> vec(26,BIT(n));
    rep(i,n){
        vec[s[i]-'a'].add(i+1,1);
    }
    rep(i,q){
        int a;
        cin>>a;
        if(a==1){
            int b;
            char c;
            cin>>b>>c;
            vec[s[b-1]-'a'].add(b,-1);
            vec[c-'a'].add(b,1);
            s[b-1]=c;
        }
        else{
            int l,r;
            cin>>l>>r;
            int ans=0;
            rep(j,26){
                ans+=(vec[j].sum(r)-(l==1?0:vec[j].sum(l-1)))>0;
            }
            cout<<ans<<endl;
        }
    }
}


Measured memory_bytes: 111516
/* template.cpp {{{ */
#include <bits/stdc++.h>
using namespace std;
#define get_macro(a, b, c, d, name, ...) name
#define rep(...) get_macro(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep(...) get_macro(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define rep1(n) rep2(i_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, b) rep4(i, a, b, 1)
#define rep4(i, a, b, s) for (ll i = (a); i < (ll)(b); i += (ll)(s))
#define rrep1(n) rrep2(i_, n)
#define rrep2(i, n) rrep3(i, 0, n)
#define rrep3(i, a, b) rrep4(i, a, b, 1)
#define rrep4(i, a, b, s) for (ll i = (ll)(b) - 1; i >= (ll)(a); i -= (ll)(s))
#define each(x, c) for (auto &&x : c)
#define fs first
#define sc second
#define all(c) begin(c), end(c)
using ui = unsigned;
using ll = long long;
using ul = unsigned long long;
using ld = long double;
const int inf = 1e9 + 10;
const ll inf_ll = 1e18 + 10;
const ll mod = 1e9 + 7;
const ll mod9 = 1e9 + 9;
const int dx[]{-1, 0, 1, 0, -1, 1, 1, -1};
const int dy[]{0, -1, 0, 1, -1, -1, 1, 1};
template<class T, class U> void chmin(T &x, const U &y){ x = min<T>(x, y); }
template<class T, class U> void chmax(T &x, const U &y){ x = max<T>(x, y); }
struct prepare_ { prepare_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(12); } } prepare__;
/* }}} */

int n[2];
int a[2][50];
bool vis[60][60][60][60][2][3];
int dp[60][60][60][60][2][3];

int dfs(int i, int j, int x, int y, int p, int q, int s, int t){
  if (vis[i][j][x][y][p][q]) return dp[i][j][x][y][p][q];
  vis[i][j][x][y][p][q] = true;
  int res = -inf;
  if (i < n[p]){
    if (a[p][i] == -1) chmax(res, -dfs(j, i + 1, 0, x + 1, p ^ 1, 0, 0, s));
    else chmax(res, -dfs(j, i + 1, y, x + 1, p ^ 1, 0, t, s + a[p][i]));
  }
  if (q == 2) chmax(res, 0);
  else chmax(res, s - t - dfs(j, i, 0, 0, p ^ 1, q + 1, 0, 0));
  return dp[i][j][x][y][p][q] = res;
}

int main(){
  rep(i, 2) cin >> n[i];
  rep(i, 2) rep(j, n[i]) cin >> a[i][j];
  cout << dfs(0, 0, 0, 0, 0, 0, 0, 0) << endl;
}

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

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

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

    if((a+b) % 2 != 0){
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }
    cout << (a+b) /2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
  int N, P[200000], count, min, i;
  scanf("%d", &N);
  for(i = 0; i < N; i++)scanf("%d", &P[i]);
  min = P[0]; count = 1;
  for(i = 1; i < N; i++){
    if(min > P[i]){
      count++;
      min = P[i];
    }
  }
  printf("%d\n", count);
  return 0;
}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> P;
#define INF 10000000000000
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for(ll i = 1; i < (ll)(n); i++)
#define repN_1(i, n) for(ll i = 0; i < (ll)(n - 1); i++)
#define repM(i, n) for(ll i = (ll)(n - 1); i >= 0; i--)
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

int main()
{
	cout << fixed << setprecision(18);
	ll n;
	cin >> n;

	ll in[100005][3];
	
	rep(i, n)
		cin >> in[i][0] >> in[i][1] >> in[i][2];

	ll dp[100005][3];
	memset(dp, 0, sizeof(dp));

	rep(i, n)
	{
		rep(j, 3)
		{
			rep(k, 3)
			{
				if (j == k)
					continue;
				else
					chmax(dp[i + 1][k], dp[i][j] + in[i][k]);
			}
		}
	}

	cout << max(dp[n][0], max(dp[n][1], dp[n][2])) << endl;


	return 0;
}

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

int main()
{
	int N;
	cin >> N;
	
	int arr[N] = {0};
	for (int i = 1;i <= N;++i){
		cin >> arr[i];
	}
	
	int c = 0;
	for (int i=1;i<=N;++i){
		if (arr[arr[i]] == i){
			c++;
		}
	}
	
	cout << (c/2) << endl;
	
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e13;
const int mod = 1e9+7;
#define ll long long
signed main() {
    int n;
    cin >> n;
    if(n<600) cout << 8 << endl;
    else if(n<800) cout << 7 << endl;
    else if(n<1000) cout << 6 << endl;
        else if(n<1200) cout << 5 << endl;
    else if(n<1400) cout << 4 << endl;
        else if(n<1600) cout << 3 << endl;
    else if(n<1800) cout << 2 << endl;
        else cout << 1 << endl;
  return 0;
}



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

#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair< int,int>
#define pll pair< ll,ll >
#define vi vector<int>
#define ss second
#define ff first
#define vii vector<pii>
#define vll vector<pll>
#define vl vector<ll>
#define vb vector<bool>
#define f(i,a,b) for(i = a;i < b;i++)
#define rf(i,a,b) for(i = a;i >= b;i--)
//template<class T> void print_data(T& a){ for(auto it : a) cout << it << " "; cout << endl; }
vector<string> board;
int a,b;

void find(char less,char more){
	board.resize(97,string(97,more));
	int cnt = 0;
	int xc = 1,yc = 1;
	while((a==b && cnt < b) || (a != b && cnt < b - 1)){
		for(int i = 0;i < 3;i++){
			for(int j=0;j < 3;j++){
				if(i == 1 && j == 1) continue;
				board[xc + i][yc + j] = less;
			}
		}

		if(yc == 93){
			xc += 4;
			yc = 1;
		}
		else yc += 4;

		cnt++;
	}

	cnt = 0;
	xc = 2;
	yc = 4;
	while(cnt < (b - a - 1)){
		board[xc][yc] = less;
		if(yc == 92){
			xc += 2;
			yc = 2;
		}
		else if(yc == 2){
			xc += 2;
			yc += 2;
		}
		else{
			yc += 4;
		}
		cnt++;
	}
	if(a == b) board[2][3] = more;
}

int main(){
	std::ios::sync_with_stdio(false);
	int i,j;
	cin >> a >> b;
	if(a > b){
		swap(a,b);
		find('#','.');
	}
	else find('.','#');

	cout << "97 97\n";
	f(i,0,board.size())
		cout << board[i] << endl;
	return 0;
}


Measured memory_bytes: 256