akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (ll i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define Rev(a) reverse(a.begin(), a.end())
#define popcnt(n) __builtin_popcount(n)
#define MATHPI acos(-1)
#define itn int
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-19;


const int NMAX=1000001;


signed main() {
    ll n;
    cin >> n;
    ll a, b;
    
    ll r = 0;
    
    rep(i, n) {
        cin >> a >> b;
        if (a == b) {
            r++;
        } else r = 0;
        if (r >= 3) {
            mes("Yes");
            re0;
        }
    }
    mes("No");
    
 
    
}

Measured memory_bytes: 3632
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;

    Main() {
        Scanner sc = new Scanner(System.in);
        boolean ok  = true;
        int N = sc.nextInt();
        for(int i=0;i<N;i++){
            int num = sc.nextInt();
            if(num%2==0){
                if(num%3==0||num%5==0){

                }else{
                    ok=false;
                }
            }
        }
        System.out.println(ok?"APPROVED":"DENIED");
    }

    public static void main(String[] args) {
        new Main();
    }
}


Measured memory_bytes: 25044
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, C: int, B: "List[int]", A: "List[List[int]]"):
    num = 0
    for Ai in A:
        c = 0
        for a, b in zip(Ai, B):
            c += a*b
        if c + C > 0:
            num += 1 
    print(num)

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    B = [ int(next(tokens)) for _ in range(M) ]  # type: "List[int]"
    A = [ [ int(next(tokens)) for _ in range(M) ] for _ in range(N) ]  # type: "List[List[int]]"
    solve(N, M, C, B, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
 
using namespace std;
 
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
 
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
 
const long long INF = 1LL << 60;
#define PI 3.14159265359 
 
template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}
 
int gcd(int a, int b){
    if(b == 0) return a;
    else return gcd(b, a%b);
}
 
long long lcm (int a, int b){
    return  (long long) a*b /gcd(a,b);
}


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

    int L = X-(K-1);
    int R = X+(K-1);

    for(int i = L; i<= R; i++){
        cout <<i << " " ;
    }
    cout << endl;

}

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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = INT_MAX / 2; const ll INF = LLONG_MAX / 2;
//template end



int main(){
    int f; scanf("%d",&f);
    printf("%d\n",(f-30)/2);
    return 0;
}


Measured memory_bytes: 3188
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

int main(){
  ll n,m;cin>>n>>m;
  vector<string> a(n),b(m);
  rep(i,0,n){cin>>a[i];}
  rep(i,0,m){cin>>b[i];}
  if(a==b){
        cout<<"Yes"<<endl;
        return 0;
      }
  rep(i,0,n-m){
    rep(j,0,n-m){
      bool ok=true;
      rep(x,0,m){
        rep(y,0,m){
          if(a[i+x][j+y]!=b[x][y])ok=false;
        }
      }
      if(ok){
        cout<<"Yes"<<endl;
        return 0;
      }
    }
  }
  cout<<"No"<<endl;return 0;
}



Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n;
  cin >> n;
  vector<vector<int> > G(n);
  rep(i,n-1) {
    int a,b;
    cin >> a >> b;
    a--; b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }
  vector<ll> c(n);
  rep(i,n) cin >> c[i];
  sort(all(c), greater<ll>());

  vector<bool> visited(n,false);
  vector<ll> ans(n);
  queue<int> que;
  que.push(0);
  ans[0] = c[0];
  visited[0] = true;
  int ind = 1;
  ll m = 0;
  while(!que.empty()) {
    int u = que.front(); que.pop();
    for (auto v : G[u]) {
      if (visited[v]) continue;
      visited[v] = true;
      que.push(v);
      ans[v] = c[ind++];
      m += ans[v];
    }
  }
  cout << m << endl;
  rep(i,n) cout << ans[i] << " ";
  cout << endl;
  return 0;
}

Measured memory_bytes: 1152
#include <algorithm>
#include<iostream>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<set>
#include<string>
#include <sstream>
#include<bitset>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
const int INF = 0x7fffffff;
using lll = long long;
using ull = unsigned long long;
using namespace std;


int main(){
  lll ii,jj,kk;


  lll n;

  cin >> n;
  
 lll ret;  
  ret = n;

  vector<lll> temp;
  

  while(ret != 0){

    if(ret % 26 == 0){
      temp.push_back(26);
      ret -= 1;
    }
    else{
      temp.push_back(ret % 26);
    }

    ret = ret / 26;
    
  }
  string res;
  for(ii=temp.size()-1;ii>=0;ii--){
    //cout << temp[ii] << "," ;
    //if(temp[ii] != 0){
      res += 'a' + temp[ii] - 1;
      //}
    //else{
    //  res += 'z';
    //}
  }
  //cout << endl;
  
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3600
#include<stdio.h>
main(){
	int i,text,a,b;
	while(scanf("%d",&a)!=EOF){
		scanf("%d",&b);
		i=1;
		a+=b;
		while(a>=10){
			a/=10;
			i++;
		}
	printf("%d\n",i);
}
	return 0;
}

Measured memory_bytes: 600
#include<iostream>

using namespace std;

long fac(int n)
{
    long res = 1;
    for(int i = n; i > 0; i--)
        res = res * i;
    return res;
}

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

    if(n < 1 || n > 20)
        cout << "Error" << endl;
    else
        cout << fac(n) << endl;

    return 0;
} 

Measured memory_bytes: 1160
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>

using namespace std;

typedef long long ll;

int main(){
    int x,y;
    cin >> x >> y;
    if(x == 0 && y == 0){
        cout << "Yes" << endl;
        return 0;
    }else if(x == 0 || y == 0){
        cout << "No" << endl;
        return 0;
    }
    for(int i = 0; i <= x; i++){
        if(i*2 + (x-i)*4 == y){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3636
N = int(input())
H = list(map(int, input().split()))

movemax = 0
movetimes = 0
i = 0

while i < N-1:
    if H[i] >= H[i+1]:
        movetimes += 1
    else :
        movemax = max(movemax, movetimes)
        movetimes = 0
    i += 1
    
movemax = max(movemax, movetimes)
    
print(movemax)


Measured memory_bytes: 14224
import java.util.*;
public class Main {

	public void doIt(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		while(n != -1){
			double a=1,b = 1, c = 1;
			double rad = 0.0;
			for(int i = 1; i < n; i++){
				a = c;
				c = Math.sqrt(b + a * a);
				rad += Math.atan2(b, a);
			}
			System.out.printf("%1.2f\n%1.2f\n", c * Math.cos(rad), c * Math.sin(rad));

			//読み込み
			n = sc.nextInt();
		}
	}
	public static void main(String[] args) {
		Main obj = new Main();
		obj.doIt();

	}
}

Measured memory_bytes: 0
#include <iostream>
#include <fstream>

using namespace std;

string _myStr = "";

void CParseIn () {
    cin >> _myStr;
}

void Core () {
    for (int i = 0; i < _myStr.length(); i++) {
        if (_myStr[i] == ',') {
            cout << " ";
        }
        else
        cout << _myStr[i];
    }  
}

void CWriteOut () {
    cout << endl;
}

int main () {
    
    CParseIn();
    Core();
    CWriteOut();

    return 0;
}

Measured memory_bytes: 256
/*input
9
1 2 4 9 5 8 7 3 6
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=500005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
int a[maxn];
bool tg[maxn];
int main()
{
	IOS;
	int n;
	cin>>n;
	REP(i,n) cin>>a[i];
	REP(i,n) a[i]--;
	REP(i,n) if(a[i]==i) tg[i]=1;
	REP(i,n) if(i){
		if(tg[i]&&tg[i-1]) tg[i]=0;
	}
	int ans=0;
	REP(i,n) ans+=tg[i];
	cout<<ans<<'\n';
}



Measured memory_bytes: 768
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		short input = scanner.nextShort();
		scanner.close();

		if (input < 1200) {
			System.out.print("ABC");
		} else if(input < 2800) {
			System.out.print("ARC");
		} else {
			System.out.print("AGC");
		}
	}
	
}

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

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}


int main(){

  ll n,m;
  cin >> n >> m;

  vector<ll> d;
  ll i = 1;
  while(i*i <= m){
    if(m%i==0){
      d.push_back(i);
      d.push_back(m/i);
    }
    i++;
  }

  sort(d.begin(), d.end(), greater<ll>());
  

  rep(j,d.size()){
    if(d[j]*n<=m){
      cout << d[j] << endl;
      return 0;
    }
  }

  

  return 0;
} 

Measured memory_bytes: 256
S=input()
l=len(S)

count=0

if l%2==0:
    for i in range(l//2):
        if S[i]!=S[(l-1)-i]:
            count+=1
else:
    for j in  range((l-1)//2):
        if S[j]!=S[(-1)-j]:
            count+=1

print(count)
    

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

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

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll N;
	string A, B;
	cin >> N >> A >> B;
	ll res, ind;
	bool prev;
	if(A[0]==B[0]){
		res = 3;
		ind = 1;
		prev = true;
	}else{
		res = 6;
		ind = 2;
		prev = false;
	}

	while(ind<N){
		if(prev){
			if(A[ind]==B[ind]){
				res *= 2;
				ind += 1;
				prev = true;
			}else{
				res *= 2;
				ind += 2;
				prev = false;
			}
		}else{
			if(A[ind]==B[ind]){
				res *= 1;
				ind += 1;
				prev = true;
			}else{
				res *= 3;
				ind += 2;
				prev = false;
			}
		}
		res %= mod;
	}
	cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        HashSet<Integer> integers = new HashSet<>();
        integers.add(in.nextInt());
        integers.add(in.nextInt());
        integers.add(in.nextInt());
        System.out.println(integers.size() == 2 ? "Yes" : "No");
    }
}


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

using namespace std;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int MOD = 1e9+7;
const long long INF = 1LL << 60;
const int inf = 1e9;
typedef long long ll;

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    int num = a-b;
    if(c-num<0){
        cout<<0<<endl;
    }else{
        cout<<c-num<<endl;
    }
    
}

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

using namespace std;

int main(){
    long double l;
    cin>>l;
    
    long double hoge=l/3;
    
    cout<<fixed<<setprecision(7)<<hoge*hoge*hoge<<endl;
    
    return 0;
}

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

int main(){
    int n; cin >> n;
    int A[n+1];
    int x;
    for(int i = 0; i < n; i++){
        cin >> x;
        A[x] = i+1;
    }
    for(int i = 1; i < n; i++){
        cout << A[i] << " ";
    }
    cout << A[n] << endl;
}

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

int main() {
	string s; cin >> s;
	int n = s.size();
	int K; cin >> K;
	vector<vector<vector<int> > > dp(n, vector<vector<int> >(n, vector<int>(K+1, 0)));
	for (int i = 0; i < n; ++i) {
		for (int k = 0; k < K+1; ++k) dp[i][i][k] = 1;
		if (i < n-1) {
			if (s[i] == s[i+1]) dp[i][i+1][0] = 2;
			else if (K > 0) dp[i][i+1][1] = 2;
		}
	}
	for (int k = 0; k < K+1; ++k) {
		for (int x = 1; x < n; ++x) {
			for (int i = 0; i < n-x; ++i) {
				int j = i+x;
				if (k > 0) dp[i][j][k] = max(dp[i][j][k], dp[i][j][k-1]);
				dp[i][j][k] = max(dp[i][j][k], dp[i+1][j][k]);
				dp[i][j][k] = max(dp[i][j][k], dp[i][j-1][k]);
				if (s[i] == s[j] && x > 1) dp[i][j][k] = max(dp[i][j][k], dp[i+1][j-1][k] + 2);
				else if (k > 0 && x > 1) dp[i][j][k] = max(dp[i][j][k], dp[i+1][j-1][k-1] + 2);
			}
		}
	}
	cout << dp[0][n-1][K] << endl;
	return 0;
}

Measured memory_bytes: 109568
def egcd(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    gcd=a
    return gcd

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

tmp=egcd(HP[0],HP[1])

for i in range(1,N-1):
    tmp=egcd(tmp,HP[i+1])
    
print(tmp)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define FOR(i, n) for(int i = 0; i < (n); ++i)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define TRAV(i, a) for(auto & i : (a))
#define SZ(x) ((int)(x).size())
#define PR std::pair
#define MP std::make_pair
#define X first
#define Y second
typedef long long ll;
typedef std::pair<int, int> PII;
typedef std::vector<int> VI;

const int MOD = 998244353;
int dp[3005];
int main(){
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(0);
	int n, s;
	std::cin >> n >> s;
	VI A(n+1);
	FOR(i, n) std::cin >> A[i+1];
	int ans = 0;
	dp[0] = 1;
	REP(i, 1, n+1){
		for(int j=s; j > A[i]; --j)
			dp[j] = (dp[j]+dp[j-A[i]])%MOD;
		dp[A[i]] = (dp[A[i]] + i)%MOD;
		ans = (ans+dp[s])%MOD;
	}
	std::cout << ans;

	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<sstream>
#include<utility>
#include<map>
#include<ctime>
#include<cstdio>
#include<cassert>
#include<functional>
#include<unordered_map>
#include<deque>




using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;
typedef pair<double, double> pdd;

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

const long double PI = 3.14159265358979323846;
const long double eps = 1e-5;
const ll INF = numeric_limits<int>::max();
const ll LINF = numeric_limits<ll>::max();
const ll mod = 1000 * 1000 * 1000 + 7;



void solve() {
    int k;
    cin >> k;
    cout << (k / 2) * ((k + 1) / 2) << endl;


}


//#define LOCAL

int main() {
    ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
        solve();



#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif	
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

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

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll A, B, C;
  cin >> A >> B >> C;
  cout << C - min(C, A - B) << endl;
  return 0;
}


Measured memory_bytes: 256
use std::io;


fn main() {
    let n = read_one::<u8>();
    let ss = read_one::<String>().chars()
        .map(|c| (n + (c as u8) - b'A') % 26)
        .map(|i| (i + b'A') as char)
        .collect::<String>();
    println!("{}", ss);
}

#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

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

using ll = long long;

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

    int ans = 10000;
    for (ll d = 1; d * d <= N; d++) {
        if (N % d != 0) continue;
        // cerr << "foo" << endl;
        ans = min(ans, (int)max(to_string(d).size(), to_string(N / d).size()));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#define DEBUG 0

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

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------
#define MOD 998244353

vi adjList[100000];
int power[100001];
int grundy[3][100000],num[3][1000];
int main() {
    int i,j,k;
    int N,M,u,v;
    scanf("%d",&N);
    power[0] = 1,power[1] = ((LLI) 1e18) % MOD;
    for (i = 2; i <= N; i++) power[i] = ((LLI) power[i-1]*power[1]) % MOD;
    for (i = 0; i < 3; i++) {
        scanf("%d",&M);
        for (j = 0; j < M; j++) {
            scanf("%d %d",&u,&v);
            u--,v--;
            if (u > v) swap(u,v);
            adjList[u].pb(v);
        }
        for (j = N-1; j >= 0; j--) {
            set<int> S;
            for (k = 0; k < adjList[j].size(); k++) S.insert(grundy[i][adjList[j][k]]);
            while (S.count(grundy[i][j])) grundy[i][j]++;
            num[i][grundy[i][j]] += power[j+1],num[i][grundy[i][j]] %= MOD;
            adjList[j].clear();
        }
    }

    int ans = 0;
    for (i = 0; i < 1000; i++) {
        for (j = 0; j < 1000; j++) ans += ((((LLI) num[0][i]*num[1][j]) % MOD)*num[2][i^j]) % MOD,ans %= MOD;
    }
    printf("%d\n",ans);

    return 0;
}



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

int main() {
  string s;
  cin >> s;
  int ans = 0;
  string t = "";
  rep(i, s.size()) {
    for (int j = 1; i + j <= s.size(); j++) {
      string u = s.substr(i, j);
      if (t != u) {
        ans++;
        i += j - 1;
        t = u;
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
  ll n,h;
  cin >> n >> h;
  vector<ll> a(n),b(n);
  for(int i=0; i<n;i++)
    cin >> a.at(i) >> b.at(i);
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  reverse(a.begin(),a.end());
  reverse(b.begin(),b.end());
  for(int i=n-1; i>=0; i--){
    if(b.at(i)<a.at(0))
      b.pop_back();
    else
      break;
  }
  for(int i=0; i<b.size(); i++){
    h-=b.at(i);
    if(h<=0){
      cout << i+1 << endl;
      return 0;
    }
  }
  if(h%a.at(0)==0)
  cout << b.size() + h / a.at(0) << endl;
  else
    cout << b.size()+1+h/a.at(0) <<endl;
  return 0;
}


Measured memory_bytes: 1792
#https://atcoder.jp/contests/abc079/tasks/abc079_c
# -*- coding: utf-8 -*-
A = input()
numbers = []
for i in range(len(A)):
  numbers.append(int(A[i]))
n = len(A)-1 #オペレータの数
for i in range(2**n):
  tmp = numbers[0]
  ans = str(numbers[0])
  for j in range(n):
    if (i >> j) & 1:
      tmp += numbers[j+1]
      ans += "+"
      ans += str(numbers[j+1])
    else:
      tmp -= numbers[j+1]
      ans += "-"
      ans += str(numbers[j+1])
  if tmp == 7: 
    print(ans+"=7")
    break

Measured memory_bytes: 38384
function Main(input) {
  var A = parseInt(input.split(" ")[0]);
  var B = parseInt(input.split(" ")[1]);
  
  if((A % 2 == 0 && B % 2 == 1) || (A % 2 == 1 && B % 2 == 0)){
    console.log("IMPOSSIBLE") ;
    return;
  }else{
    console.log((A + B) / 2);
  }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7496
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define x first
#define y second
#define pi acos(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(x))
#define MEM(x) memset(x,0,sizeof(x))
#define less Less
#define EPS 1e-4
#define arg ARG
#define cpdd const pdd
#define rank Rank
#define KK 500
#define N 100005
#define MXN 2000005
const int mod=1e6+3;
int main(){
    LL t;
    scanf("%lld",&t);
    if(t==0){
        printf("0\n");
        return 0;
    }
    LL pow[105];
    pow[0]=1;
    for(int i = 1;i<33;i++){
        pow[i]=pow[i-1]*3;
    } 
    LL ans=t;
    LL temp=4;
    for(int i=1;i<33;i++){
        LL tmp=t-temp;
        LL sum=i*2;
       // printf("%d %d\n",tmp,sum);
        if(tmp<0)
        break;
        for(int j=i;j>=0;j--){
            sum+=tmp/pow[j];
            tmp%=pow[j];
        }
        //printf("%d\n",sum);
        ans=min(ans,sum);
        temp+=pow[i]+pow[i+1];
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 3208
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 
using namespace std;

int main()
{
    int r,g,b,n;
    while (~scanf("%d %d %d %d",&r,&g,&b,&n)) {
        int ans = 0;
        REP(i,0,n)REP(j,0,n) {
            int x = n - i*r - j*g;
            if (x>=0 && x%b==0) {
                ans++;
            }
        }
        printf("%d\n", ans);
    }
    return 0;
}







Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array;


void main() {
    auto a = readln.split.to!(int[]).sort();
    writeln(equal(a, [5, 5, 7]) ? "YES" : "NO");
}



void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


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

bool usednumber[1000005];
bool ng[1000005];

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; ++i)  cin >> a[i];
    sort(a.begin(), a.end());
    a.emplace_back(a.back() + 1);
    
    int ans = 0;
    for(int i = 0; i < n; ++i){
        if(usednumber[a[i]])    continue;
        usednumber[a[i]] = true;
        if(!ng[a[i]] && *lower_bound(a.begin() + i + 1, a.end(), a[i]) != a[i])  ++ans;
        for(int j = a[i] * 2; j < a[n]; j += a[i]){
            if(*lower_bound(a.begin() + i + 1, a.end(), j) == j){
                ng[j] = true;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 6040
import math
h = int(input())
a = 10000000000000
b = 0
for i in range(40):
    if a > h - pow(2, i) >= 0:
        a = h - pow(2, i)
        b = i

c = 0
for i in range(b+1):
    c += pow(2, i)

print(c)

Measured memory_bytes: 3060
import java.util.*;
import java.io.*;

class Item {
   int weight,val;
   public Item(int weight, int val) {
      this.weight = weight;
      this.val = val;
   }
}

public class Main {
	
  public static void main(String[]abc) {
     Main ans = new Main();
     System.out.println(ans.solve());
  }
  
  private long solve() {
     Scanner sc = new Scanner(System.in);
     int N = sc.nextInt();
     int maxWeight = sc.nextInt();
     Item [] items = new Item[N+1];
     for(int i=1;i<=N;i++){
        items[i] = new Item(sc.nextInt(), sc.nextInt());
     }
     int maxVal = N * 1000;
     long [][] dp =new long[N+1][maxVal+1];
     long INF = (long) 1e9+7;
     for(int i=0;i<=N;i++) {
        Arrays.fill(dp[i], INF);
     }
     dp[1][items[1].val] = items[1].weight;
     dp[0][0] = 0;
    
     for(int i=1;i<=N;i++){
       for(int val=0;val<=maxVal;val++){
          dp[i][val] = dp[i-1][val];
          //System.out.printf("dp[%d][%d]: %d\n", i, val, dp[i][val]);
          if (items[i].val > val) continue;
          dp[i][val] = Math.min(dp[i-1][val], dp[i-1][val-items[i].val] + items[i].weight);
          //System.out.printf("\tdp[%d][%d]: %d\n", i, val, dp[i][val]);
       }
     }
     
     long answer =0;
     for(int val=0;val<=maxVal;val++){
        if (dp[N][val]<=maxWeight) answer = Math.max(answer, val);
     }
     return answer;
  }
}

Measured memory_bytes: 140572
N = int(input())
L,R = [None]*N,[None]*N
for i in range(N):
  L[i],R[i] = map(int,input().split())
L.append(0)
R.append(0)
L.sort(reverse=True)
R.sort()

def it():
  for l,r in zip(L,R):
    if r < l:
      yield 2*(l-r)
    else:
      return

print(sum(it()))

Measured memory_bytes: 13352
#include <iostream>

int A[1000000], n;

int binarySearch(int key)
{
	int left = 0;
	int right = n;
	int mid;
	while (left < right)
	{
		mid = (left + right) / 2;
		if (A[mid] == key)
		{
			return mid;
		}
		else if (A[mid] > key)
		{
			right = mid;
		}
		else
		{
			left = mid + 1;
		}
	}
	return -1;
}

int main()
{
	using namespace std;
	int q, k, sum = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> A[i];
	}
	cin >> q;
	for (int i = 0; i < q; i++)
	{
		cin >> k;
		if (binarySearch(k) + 1)
		{
			sum++;
		}
	}
	cout << sum << endl;
}


Measured memory_bytes: 3380
#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<cstring>
#include<map>
#include<set>
#include<cstdlib>
#include<bitset> 
using namespace std;
typedef long long ll;
int main(void)
{
	ll x,y;
	cin>>x>>y;
	if(y%2==0&&x*2<=y&&x*4>=y) puts("Yes");
	else puts("No");
	
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int count = n / 15;
		int x = 800 * n;
		int y = 200 * count;

		System.out.println(x - y);

	}

}


Measured memory_bytes: 35612
#include <iostream>
#include <cstdio>

using namespace std;

int n;
int a[105];
int p[105][15];

int main()
{
    scanf("%d", &n);
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < 10; j++)
        {
            int t;
            scanf("%d", &t);
            a[i] = (a[i]<<1) | t;
        }
    }
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < 11; j++)
        {
            scanf("%d", &p[i][j]);
        }
    }
    int mx = -2e9;
    for(int i = 1; i < 1024; i++)
    {
        int sum = 0;
        for(int j = 0; j < n; j++)
        {
            int t = i & a[j];
            int cnt = 0;
            for(; t; t>>=1) cnt += t & 1;
            sum += p[j][cnt];
        }
        mx = max(mx, sum);
    }
    printf("%d", mx);
    return 0;
}


Measured memory_bytes: 764
#include<stdio.h>
char s[4];
int t=0;
int main(){
	scanf("%s",&s);
  	for(int k=0;k<4;k++){
    	if(s[k]=='+')t++;
    	else if(s[k]=='-')t--;
    }
  	printf("%d",t);
  	return 0;
}


Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
//typedef unsigned int uint;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int A, B, K;
	cin >> A >> B >> K;

	int ans = 0;
	rrep(i, 1, min(A, B)+1)
	{
		if (A%i == 0 && B%i == 0)
		{
			ans++;
			if (ans == K)
			{
				cout << i << endl;
				return 0;
			}
		}
	}

	return 0;
}

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

int N, M;
int A[310][310];
set<int> st;

int rec() {
  if (st.size() == 0) return 1e18;

  int cnt[310] = {0};
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      if (st.find(A[i][j]) != st.end()) {
        cnt[A[i][j]]++;
        break;
      }
    }
  }

  int mx = 0, er;
  for (int i = 0; i < M; i++) {
    if (mx < cnt[i]) {
      mx = cnt[i];
      er = i;
    }
  }

  st.erase(er);

  return min(mx, rec());
}

signed main() {
  cin >> N >> M;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      cin >> A[i][j];
      A[i][j]--;
    }
  }

  for (int i = 0; i < M; i++) st.insert(i);

  cout << rec() << endl;
  return 0;
}


Measured memory_bytes: 1664
while True:
    try:
        values = [int(i) for i in raw_input().split(',')]
    except:
        break
    kukaku = values[:-2]
    aspeed = values[10]
    bspeed = values[11]
    nagasa = reduce(lambda x,y:x+y,kukaku)
    jikan  = float(nagasa) / (aspeed + bspeed)
    ekinag = map(lambda x:reduce(lambda x,y:x+y,kukaku[:x]),xrange(1,11))
    for i, j in enumerate(ekinag):
        if(j >= jikan * aspeed):
            print i+1
            break

Measured memory_bytes: 4340
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <climits>
#define rep(i, n) for(Int (i) = 0; (i) < (n); (i)++)
using namespace std;
using Int = int32_t;
using ll = long long int;
using ull = unsigned long long int;
constexpr ull mod = 1e9 + 7;


int main() {

	Int N; cin >> N;
	string S, T; cin >> S >> T;
	rep(i, N) {
		cout << S[i] << T[i];
	}

	cout << endl;

}

Measured memory_bytes: 256
{-# OPTIONS_GHC -O #-}
{-# LANGUAGE ViewPatterns #-}

import Control.Monad
import Control.Monad.ST
import Data.Maybe
import Data.Array.Unboxed
import Data.Array.ST
import qualified Data.Sequence as SQ
import Data.Sequence ((|>), (<|), ViewL(..), ViewR(..))

main = do
    (h:w:_)<-map read.words<$>getLine::IO [Int]
    m <- concat <$> replicateM h getLine :: IO String
    --
    let wn = length $ filter(=='.') m
    let bd = sol' h w $ listArray ((1,1),(h,w)) $ map (\c->if c=='.' then 0 else (-1)) m::UArray (Int,Int) Int
    let g = bd ! (h,w)
    print $ if g == 0 then (-1) else wn - g
--
sol' :: Int -> Int -> UArray (Int,Int) Int -> UArray (Int,Int) Int
sol' h w bd = runSTUArray $ do
    m <- thaw bd :: ST s (STUArray s (Int,Int) Int)
    solve h w m $ SQ.singleton ((1,1),1)
    return m

solve :: Int -> Int -> STUArray s (Int,Int) Int -> SQ.Seq ((Int,Int),Int) -> ST s ()
solve _ _ _ (SQ.viewl -> SQ.EmptyL) = return ()
solve h w m (SQ.viewl -> ((i,j),s) :< sq)
    | i<1 || i>h || j<1 || j>w = solve h w m sq
    | otherwise = do
        x <- readArray m (i,j)
        if x /= 0 then solve h w m sq
        else do
            writeArray m (i,j) s
            solve h w m $ foldl (|>) sq $ zip [(i-1,j),(i+1,j), (i,j-1), (i,j+1)] $ repeat (s+1)


Measured memory_bytes: 1148
#include <stdio.h>
#include <string.h>
int main(){
    int n, t, h, val;
    char taro[105], hanako[105];

    scanf("%d", &n);
    t = h = 0;
    while(n--){
        scanf("%s %s", taro, hanako);
        val = strcmp(taro, hanako);
        if(val>0){
            t += 3;
        }else if(val < 0){
            h += 3;
        }else{
            t++;
            h++;
        }
    }
    printf("%d %d\n", t, h);
return 0;
}



Measured memory_bytes: 2048
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    vector<pair<int,int>> vp;
    for(int i = 0; i < n; i++){
        int a, b;
        cin >> a >> b;
        vp.push_back({b,a});
    }
    sort(vp.begin(), vp.end());
    ll now = 0;
    for(int i = 0; i < n; i++){
        now += vp[i].second;
        if(now > vp[i].first){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int X,N,M=0;
  cin >> X >> N;
  int A=X,B=X;
  bool E=false,F=false;
  vector<int>vec(N);
  for (int i=0; i<N; i++){
    cin >>vec[i];
    if (vec[i]==X){
      M=1;
    }
  }
  if (M==0){
    cout << X << endl;
    return 0;
  }
    for (int i=0; i<100; i++){
      E=false,F=false;
      A -= 1;
      B += 1;
      for (int j=0; j<N; j++){
        if (vec[j] == A){
          E=true;
        }
      }
      for (int i=0; i<N; i++){
        if (vec[i]==B){
          F=true;
        }
      }
      if (E==false){
        break;
      }
      if (F==false){
        break;
      }
    }
    if(E==false){
      cout << A << endl;
    }
    else if(F==false){
      cout << B << endl;
    }
}


Measured memory_bytes: 3576
/*
author: Apoorv Singh
*/

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

typedef vector <long long> vi;
typedef pair <long long, long long> pii;
#define pb push_back   
#define all(c) c.begin(), c.end()
#define FOR(i, a, b) for (long long i = a; i < b; ++i)
#define FORR(i, a, b) for (long long i = a; i > b; --i)
#define um unordered_map
#define F first
#define S second
#define int long long
#define inf LLONG_MAX
#define endl "\n"
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

template <class X>
void printarr(X arr[], int n)
{
    for (int i = 0; i < n; ++i)
        cout << arr[i] << " ";
    cout << endl;
}
template <typename X> ostream& operator << (ostream& x,const vector<X>& v){ for (X a : v) x << a << ' '; return x;} 
template <typename X, typename Y> ostream& operator << (ostream& x, const vector< pair<X, Y> >& v) {for (pair <X, Y> it : v) x << it.first << ' ' << it.second << endl; return x;} 
template <typename T, typename S> ostream& operator << (ostream& os, const map<T, S>& v) { for (pair <T, S> it : v) os << it.first << " => " << it.second << endl; return os; }

double pi = 3.14159265358979323846264338327950288419716939937510582097494459230;
int modulo = 1e9 + 7;

int fpow(int a, int n)
{
    int ans = 1;
    while (n)
    {
        if (n&1)
            ans = (ans * a)%modulo;
        a = (a*a)%modulo;
        n = n >> 1;
    }
    return ans;
}

/*
const int M = 1e6 + 10;
int composite[M] = {0};

void sieve()
{
    FOR(i,2,M)
    {
        if (!composite[i])
        {
            for (int j = 2*i; j < M; j += i)
                composite[j] = max(composite[j], i);
        }
    }
}
*/

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,d; cin >> n >> d;
    cout << (int) ceil(n/(double)(2*d+1));
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <queue>
using namespace std;
const int N=13;
const int M=1086;
const int K=(1<<13);
int dis[K];
int n,m;
struct bian
{
	int u,v,len;
	bian(int uu,int vv,int ww)
	{
		u=uu;
		v=vv;
		len=ww;
	}
	bian()
	{
		
	}
};
vector <bian> eds;
int to[M];
int v1[M];
int k1,k2,k3;
int maxn;
vector <int> g[K];
int tot;
struct node
{
	int u,dist;
	bool operator <(const node & rhs)const
	{
		return dist>rhs.dist;
	}
	node(int uu,int ww)
	{
		u=uu;
		dist=ww;
	}
	node()
	{
		
	}
};
void dij()
{
	for(int i=0;i<=maxn;i++)
		dis[i]=999999999;
	dis[maxn]=0;
	priority_queue <node> q;
	q.push(node(maxn,0));
	while(!q.empty())
	{
		node tp=q.top();
		q.pop();
		if(dis[tp.u]!=tp.dist)
			continue;
		int si=g[tp.u].size();
		for(int i=0;i!=si;i++)
		{
			bian & e=eds[g[tp.u][i]];
			if(dis[e.v]>tp.dist+e.len)
			{
				dis[e.v]=tp.dist+e.len;
				q.push(node(e.v,dis[e.v]));
			}
		}
	}
	return ;
}
inline void ins(int u,int v,int len)
{
	eds.push_back(bian(u,v,len));
	g[u].push_back(tot);
	tot++;
	return ;
}
int main()
{
	scanf("%d%d",&n,&m);
	maxn=(1<<n)-1;
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&k1,&k2);
		v1[i]=k1;
		to[i]=maxn;
		for(int j=0;j<k2;j++)
		{
			scanf("%d",&k3);
			to[i]^=(1<<(k3-1));
		}
	}
	for(int i=0;i<=maxn;i++)
	{
		for(int j=1;j<=m;j++)
		{
			ins(i,i&to[j],v1[j]);
		}
	}
	dij();
	if(dis[0]==999999999)
	{
		printf("-1\n");
	}
	else
	{
		printf("%d\n",dis[0]);
	}
	return 0;
}

Measured memory_bytes: 65956
/*
    Code by CNH_Tourist
*/
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unrolled-loops")

using namespace std;

/*----------------Define----------------*/
#define inp "TestCode.inp"
#define out "TestCode.out"
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define FileInOut freopen(inp,"r",stdin);freopen(out,"w",stdout);
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define pi acos(-1)
#define pii pair<int,int>
#define ppiii pair< pair <int,int> ,int>
#define INF 1000000
#define endl '\n'
#define ll long long
#define pq priority_queue
const int mod=1e9+7;
int test=1;
/*--------------------------------------*/

int n,k;
int a[100100];
int dp[100100];

int main()
{
    FAST
    cin>>n>>k;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    dp[1]=0;
    for(int i=2;i<=k;i++)
    {
        dp[i]=INT_MAX;
        for(int j=1;j<i;j++)
            dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j]));
    }
    for(int i=k+1;i<=n;i++)
    {
        dp[i]=INT_MAX;
        for(int j=i-1;j>=i-k;j--)
        {
            dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j]));
        }
    }
    cout<<dp[n];
}



Measured memory_bytes: 1024
import sys
sys.setrecursionlimit(10**6)
def MI():
    return map(int,input().split())
def I():
    return int(input())
def LI():
    return [int(i) for i in input().split()]

n=I()
a=[0]+LI()
b=[0]*(n+1)
c=[0]*(n+1)
for i in range(n,0,-1):
    if c[i]!=a[i]:
        b[i]=1 #-b[i]
        c[i]=1-c[i]
        for j in range(2,int(i**0.5+1)):
            if i%j==0:
                c[j]=1-c[j]
                if j!=i//j: c[i//j]=1-c[i//j]
                #print('i=',i,'change',j,i//j)

s=sum(b)
if s%2!=a[1]:
    b[1]=1-b[1]
s=sum(b)    
print(s)

ans=[]
for i in range(1,n+1):
    if b[i]==1:
        #print(i,end=' ')
        ans.append(i)
if s!=0:
    print(*ans)


Measured memory_bytes: 73448