akhauriyash/Code-Regression huggingface dataset:
#define _GRIBCXX_DEBUG
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <string>
#include <utility>
#include <vector>
using namespace std;

// ?????¬???????????¬??????
#define REP(i,n) for(int i=0; i<(int)n; ++i)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), c.end()

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<double> vd;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<long, long> pil;

// ??°?????????????????¬??????
typedef int Weight;

struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) :
    src(src), dst(dst), weight(weight) {}
};

bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight :
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;


int main() {
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);
  vector<int> v{a, b, c};
  sort(v.begin(), v.end());
  printf("%d %d %d\n", v[0], v[1], v[2]);

  return 0;
}

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	int n,m;
	long long int k;
	cin>>n>>m>>k;
	int a[n];
	int b[m];        
	long long int c[n];
	long long int d[m];
	int i,j;
	for(i=0;i<n;i++)
	cin>>a[i];
	for(j=0;j<m;j++)
	cin>>b[j];
	c[0]=a[0];
	d[0]=b[0];
	for(i=1;i<n;i++)
	c[i]=c[i-1]+a[i];
	for(i=1;i<m;i++)
	d[i]=d[i-1]+b[i];
	int ans=0;
	int t=-1;
	int l,r;
	int mi;
	l=0;
	r=m-1;
	while(l<=r)
	{
		    mi=l+(r-l)/2;
			if(d[mi]<=k)
			{
				t=mi;
				l=mi+1;	
			}
			else
			r=mi-1;		
	}
	if(t!=-1)
		ans=max(ans,t+1);
	for(i=0;i<n && c[i]<=k;i++)
	{
		int l,r;
		l=0;
		r=m-1;
		int t=-1;
		while(l<=r)
		{
			int mi=l+(r-l)/2;
			if(d[mi]+c[i]<=k)
			{
				t=mi;
				l=mi+1;	
			}
			else
			r=mi-1;	
		}
		if(t!=-1)
		ans=max(ans,i+t+2);
		else
		ans=max(ans,i+1);			
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 8252
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>

using namespace std;


void build_stairs()
{
  int n;
  cin >> n;
  vector<int> h(n);
  for (int i = 0; i < n; ++i) cin >> h[i];

  for (int i = n - 1; i > 0; --i)
  {
    if (h[i - 1] - h[i] > 1)
    {
      cout << "No" << "\n";
      return;
    }
    else if (h[i - 1] - h[i] == 1)
    {
      --h[i - 1];
    }
  }
  cout << "Yes" << "\n";
}


void green_bin()
{
  int n;
  cin >> n;
  map<string, int> S;
  for (int i = 0; i < n; ++i) 
  {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    S[s]++;
  }

  long long int ana_num = 0;
  for (auto value : S)
    for (int cnt = value.second - 1; cnt > 0; --cnt) 
      ana_num += cnt;
 
  cout << ana_num << "\n";
}


void alchemist()
{
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; ++i) cin >> v[i];

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

  double v_sum = v[0];
  for (int i = 1; i < n; ++i) v_sum = (v_sum + v[i]) / 2;

  cout << v_sum << "\n";
}


void lower_atc()
{
  int n;
  cin >> n;
  vector<int> h(n);
  for (int i = 0; i < n; ++i) cin >> h[i];

  int tmp = 0, v_max = 0;
  for (int i = 0; i < n; ++i)
  {
    if ((i != n - 1) && h[i] >= h[i + 1]) ++tmp;
    else
    {
      v_max = max(v_max, tmp);
      tmp = 0;
    }
  }

  cout << v_max << "\n";
}


void maximal_value()
{
  int n;
  cin >> n;
  vector<int> b(n - 1);
  for (int i = 0; i < n - 1; ++i) cin >> b[i];

  vector<int> a(n);
  for (int i = 0; i < n; ++i)
  {
    if (i == 0)          a[i] = b[i];
    else if (i == n - 1) a[i] = b[i - 1];
    else                 a[i] = min(b[i - 1], b[i]);
  }

  cout << accumulate(a.begin(), a.end(), 0) << "\n";
}


int main()
{
  build_stairs();
  //green_bin();
  //alchemist();
  //lower_atc();
  //maximal_value();
}


Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
  double x,h;
  while(cin>>x>>h,x){
    double tri=sqrt(h*h+x*x/4.0)*x/2.0;
    printf("%.6f\n",tri*4.0+x*x);
  }
}

Measured memory_bytes: 1236
import numpy as np

def solve(stdin):
    n = stdin[0]
    dp = np.zeros(n+1,dtype=np.int64)
    for i in range(1,n+1):
        for j in range(i,n+1,i):
            dp[j]+=1
    dp*=np.arange(n+1)
    return dp.sum()

def main():
    stdin = np.fromstring(open(0).read(), dtype=np.int64, sep=' ')
    print(solve(stdin))

def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', '(i8[:],)')(solve)
    cc.compile()

if __name__ == '__main__':
    import sys
    if sys.argv[-1] == 'ONLINE_JUDGE':
        cc_export()
        exit(0)
    from my_module import solve
    main()

Measured memory_bytes: 183148
#include <bits/stdc++.h>
using namespace std;
//repetition
//------------------------------------------
#define FOR(i, p, b) for (int i = (p); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
//debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \<< " " << __FILE__ << endl;

int main() {
    int N, K, A, B = 0;
    int disp = 1;
    cin >> N >> K;

    int i = 0;
    REP(i, N) {
        A = disp * 2;
        B = disp + K;
        if(A>=B){
            disp = B;
        }else{
            disp = A;
        }
    }
    cout << disp << endl;
}

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)


void func(long long N){
    cout<<(N)*(N-1)/2<<endl;
}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    func(N);
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(str, input().split()))

d = {}
t = 0
for i in a:
    if not i in d.keys():
        d[i] = 1
    else:
        d[i] += 1
    t += int(i)

q = int(input())

for _ in range(q):
    b, c = map(str, input().split())
    diff = 0
    if b in d.keys() and c in d.keys():
        diff = (int(c) - int(b)) * d[b]
        d[c] += d[b]
        d.pop(b)
    elif b in d.keys():
        diff = int(c) * d[b] - int(b) * d[b]
        d[c] = d[b]
        d.pop(b)
    t += diff
    print(t)
    

Measured memory_bytes: 91660
#include<bits/stdc++.h>
#define ll long long
#define inf 0x3f3f3f3f3f3f3f3fLL
#define rep(i,a,b) for(register ll i=(a);i<=(b);i++)
#define dep(i,a,b) for(register ll i=(a);i>=(b);i--)
using namespace std;
const int maxn=2e5+5;
//const double pi=acos(-1.0);
//const double eps=1e-9;
//const ll mo=1e9+7;
ll n,m,k;
ll a[maxn];
ll ans,tmp,cnt;
char s[maxn];
int main()
{
    int T,cas=1;
    //scanf("%d",&T);
    while(scanf("%s",s)!=EOF)
    {
        int len=strlen(s);
        int ansl=-1,ansr=-1;
        rep(i,1,len-1)
        {
            if(s[i]==s[i-1])
            {
                ansl=i;ansr=i+1;
                break;
            }
            if(i>=2&&s[i]==s[i-2])
            {
                ansl=i-1;
                ansr=i+1;
                break;
            }
        }
        printf("%d %d\n",ansl,ansr);
    }
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>

#define PI 3.14159265358979323846
using namespace std;

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

Measured memory_bytes: 3632
N,M = map(int,input().split())
#A = list(map(int,input().split()))
ans = max(0,N-2)*max(0,M-2)
if N == 2 or M == 2:
    print(0)
elif N == 1 or M == 1:
    print(max(1,max(N,M)-2))
else:
    print((N-2)*(M-2))

Measured memory_bytes: 3060
import java.util.Scanner;

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

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] a = new int[m];

		for (int i = 0; i < m; i++) {
			a[i] = sc.nextInt();
		}

		int[] dp = new int[n + 1];

		for (int i = 0; i < n + 1; i++) {
			dp[i] = 1;
		}
		for (int i = 0; i < m; i++) {
			dp[a[i]] = 0;
		}

		for (int i = 2; i < n + 1; i++) {
			if (dp[i] == 1)
				dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007;
		}

		System.out.println(dp[n]);
	}

}


Measured memory_bytes: 49960
import java.util.*;import java.io.*;import java.math.*;
public class Main
{
    public static void process()throws IOException
    {
        int n=ni();
        int[][]A=new int[n][3];
        for(int i=0;i<n;i++)
            A[i]=nai(3);
        int[][]dp=new int[n][3];
        for(int i=0;i<3;i++)
            dp[0][i]=A[0][i];
        for(int i=1;i<n;i++)
            for(int j=0;j<3;j++)
                dp[i][j]=A[i][j]+Math.max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3]);
        int ans=0;
        for(int i=0;i<3;i++)
            ans=Math.max(dp[n-1][i],ans);
        pn(ans);
    }

    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        boolean oj = true;
        if(oj){sc=new AnotherReader();out=new PrintWriter(System.out);}
        else{sc=new AnotherReader(100);out=new PrintWriter("output.txt");}
        int t=1;
        // t=ni();
        while(t-->0) {process();}
        out.flush();out.close();  
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static int[] nai(int N)throws IOException{int[]A=new int[N];for(int i=0;i!=N;i++){A[i]=ni();}return A;}
    static long[] nal(int N)throws IOException{long[]A=new long[N];for(int i=0;i!=N;i++){A[i]=nl();}return A;}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}

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

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
   
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

Measured memory_bytes: 48192
import java.util.*;
class Main {
	static int INF = -10000000;
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int sum = 0;
		for(int i = 0; i < 6; i++) {
			int tmp = stdIn.nextInt();
			switch(i) {
			case 0:
				sum += tmp;
				break;
			case 1:
				sum += tmp*5;
				break;
			case 2:
				sum += tmp*10;
				break;
			case 3:
				sum += tmp * 50;
				break;
			case 4:
				sum += tmp * 100;
				break;
			case 5:
				sum += tmp * 500;
				break;
			}
		}
		
		if(sum >= 1000) {
			System.out.println(1);
		}
		else {
			System.out.println(0);
		}
	}
}

Measured memory_bytes: 17324
def slove():
    import sys
    input = sys.stdin.readline
    n, m = list(map(int, input().rstrip('\n').split()))
    md = 1
    for i in range(1, int(m ** 0.5) + 1):
        if m % i == 0:
            if n <= m // i:
                md = max(md, i)
            if n <= i:
                md = max(md, m // i)
    print(md)


if __name__ == '__main__':
    slove()


Measured memory_bytes: 38512
N=int(input())
w=list(map(int,input().split()))
a=[]
e=[]
for i in range(N):
  x=w[0]
  w.remove(x)
  a.append(x)
  b=sum(a)
  c=sum(w)
  d=abs(b-c)
  e.append(d)
print(min(e))

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <cstdlib>
#include <math.h>

using namespace std;

typedef long long ll;
#define rep(i, n) for(long (i) = 0; (i) < (long) (n); (i)++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,a,b) for(long i=(a);i<(b);i++)
#define rrep1(i,a,b) for(long i=(a);i<=(b);i++)
#define rrrep(i,a,b) for(long i=(a);i>=(b);i--)
#define define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define X first
#define Y second
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vector<int> >
#define vpl vector<pair<long, long> >
#define vppl vector<pair<long, pair<long, long> > >

const int INF = 100100100;
const long LONG_INF = 2147483647;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const ll LINF = 1e18;


int pow(int x) {
	if (x == 0) {
		return 1;
	}
	else {
		return pow(x - 1) * 2;
	}
}

int main(int argc, char const *argv[])
{
	cin.tie(0);
	ios::sync_with_stdio(false);

    int a,b;
    cin >> a >> b;
    cout << a - b + 1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int a,b,c;
  cin >> a >> b >> c ;
  if (a == b && b == c) cout << "No" <<endl;
  else if (a != b && a != c && b != c) cout << "No" << endl;
  else cout << "Yes";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//--<for debugging>
#define whatis(x) cout << #x << " is " << x<<" ";
#define whatisl(x) cout << #x << " is " << x<<"\n";
#define parr(array,end)for(ll loop=0;loop<end;loop++)cout<<array[loop]<<" ";cout<<"\n";
#define lline cout<<"\n";
#define errorl(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout<<"\n";}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout<<"___";}
    
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a <<" , ";
    err(++it, args...);
}
//--</for debugging> 
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define testcase ll tt; cin >> tt; while(tt--)
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define vars ll h,i,j,k,d,l,p,q,r,x,y,a,b,c,v,var,n,m,z,s,ans,ind1,ind2,flag,limit1,limit2,limit3,mod;
#define vll vector<ll>
#define pll pair<ll,ll>
#define sll set<ll>
#define pint pair<int,int>
const ll INF=1e9+7;
const ll MOD=1e9+7;
int main()
{
    boost vars
    cin>>n>>k;
    ans=0;
    for(i=k;i<=n+1;i++)
    {
        a=((i-1)*(i))/2;//minima;
        b=n*i-a;//maxima;
        ans=(ans+b-a+1)%MOD;
        //errorl(ans,b-a+1);
    }
    cout<<ans;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int n,d,cnt=0;
    cin >> n >> d;
    int x[n][d];
    for(int i=0;i<n;i++){
        for(int j=0;j<d;j++)cin >> x[i][j];
    }
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            int y = 0;
            for(int k=0;k<d;k++)y += (x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
            for(int k=1;k<=400;k++)if((k*k)==y)cnt++;
        }
    }
    cout << cnt << endl;
}


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


int main(){
    unsigned long long X;
    scanf("%lld", &X);
    unsigned long long Y = 100;
    unsigned long long maxY = 18446744073709551614;
    unsigned long long t = 1;
    while (Y < maxY){
        Y *= 1.01;
        if (Y >= X)
        {
            printf("%lld\n", t);
            break;
        }else{
            t += 1;
        }
        
    }
  
}

Measured memory_bytes: 3756
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>



using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const double EPS = (1e-10);
long long const MOD = 1000000007;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fastInput() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}


int solve(string S) {
    int maruCnt = 0;
    int kadoCnt = 0;
    int maruCntArray[105] = {0};
    int kadoCntArray[105] = {0};
    stack<int> maruIdx;
    stack<int> kadoIdx;
    int ret = 1;
    for (int i = 0; i < S.length(); i++) {
        if (S[i] == '(') {
            maruIdx.push(i+1);
            maruCnt++;
        }
        if (S[i] == '[') {
            kadoIdx.push(i+1);
            kadoCnt++;
        }
        if (S[i] == ')') {
            if (maruIdx.empty()) {
                ret = 0;
                break;
            }
            if (kadoCntArray[maruIdx.top()] != kadoCntArray[i]) {
                ret = 0;
            }
            maruIdx.pop();
            maruCnt--;
        }
        if (S[i] == ']') {
            if (kadoIdx.empty()) {
                ret = 0;
                break;
            }
            if (maruCntArray[kadoIdx.top()] != maruCntArray[i]) {
                ret = 0;
            }
            kadoIdx.pop();
            kadoCnt--;
        }
        maruCntArray[i+1] = maruCnt;
        kadoCntArray[i+1] = kadoCnt;
    }
    if (!kadoIdx.empty() || !maruIdx.empty() ) ret = 0;
    return ret;
}

int main(void) {
    string S;
    vector<int> ans;
    while (1) {
        getline(cin, S);
        if (S.length() == 1 && S[0] == '.') break;
        ans.push_back(solve(S));
    }
    for (auto &i : ans) {
        if (i) {
            cout << "yes" << endl;
        } else {
            cout << "no" << endl;
        }
    }

}




Measured memory_bytes: 3180
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	int a,b;
	cin >> a >> b;
	if(a>12){
		cout << b << endl;
	}else if(a>5){
		cout << b/2 << endl;
	}else{
		cout << 0 << endl;
	}
	return 0;
}


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

cnt = 0
for i in range(1, N-1):
#  print (i, p[i-1], p[i], p[i+1])
  if (p[i+1] - p[i]) * (p[i] - p[i-1]) > 0:
    cnt += 1

print (cnt)

Measured memory_bytes: 3060
n, t = map(int, input().split())
A = tuple(map(int, input().split()))
AI = [(i, a) for i, a in enumerate(A)]
AI = sorted(AI, key=lambda x: x[1])

# 小さい順に見ていく
count = 0
maxdiff = 0
visited = [0] * n
for i, a in AI:
    if visited[i]:
        continue
    visited[i] = 1

    for j in range(i+1, n):
        if visited[j]:
            break
        visited[j] = 1
        diff = A[j] - a
        if diff > maxdiff:
            count = 1
            maxdiff = diff
        elif diff == maxdiff:
            count += 1
print(count)


Measured memory_bytes: 25392
i = list(map(int, input().split()))
accept = [0] * i[0]
miss = [0] * i[0]
# print(accept)
for j in range(i[1]):
    s = input().split()
    if(accept[int(s[0]) - 1] == 1):
        # print("already")
        print('',end='')
        pass
    elif(s[1] == 'AC'):
        accept[int(s[0]) - 1] = 1
    else:
        miss[int(s[0]) - 1] += 1

for j in range(i[0]):
    if(accept[j] == 0):
        miss[j] = 0
print(sum(accept), sum(miss))

Measured memory_bytes: 52312
#include <iostream>
#include <vector>
#include <algorithm>
#include <sstream>
#include <bitset>
using namespace std;
 
int main(){
    int N, M;
    cin >> N >> M;
 
    vector<int> X(M);
    for(int i=0; i<M; i++){
        cin >> X[i];
    }
    sort(X.begin(), X.end());
 
    vector<int> cost(M-1);
    for(int i=0; i<M-1; i++){
        cost[i] = X[i+1] - X[i];
        // cout << cost[i] << endl;
    }
 
    sort(cost.begin(), cost.end());
    int ans = 0;
 
    for(int i=0; i<M-N; i++){
        ans += cost[i];
    }
 
    cout << ans;
 
 
 
    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>

int main(){
        int n, k;
        char s[11];
        scanf("%d %s %d", &n, s, &k);
        for(int i=0; i<n; i++){
                if(s[i]==s[k-1]) putchar(s[i]);
                else putchar('*');
        }
        puts("");
        return 0;
}


Measured memory_bytes: 128
n,a,b = map(int,input().split())

def modComb(n,r,mod):
    tmp = 1
    for i in range(1,r+1):
        tmp = tmp * (n-i+1) % mod
        tmp = tmp * pow(i,mod-2,mod)
    
    return tmp % mod


mod = 10**9+7
ans = pow(2,n,mod) - 1

print((ans-modComb(n,a,mod)-modComb(n,b,mod)) % mod)



Measured memory_bytes: 40172
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
template<class T>inline void out(T t){cout << t << "\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout << t << " ";out(ts...);}
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;}
constexpr int INF = 1e18;

using T = tuple<int, int, int>;

signed main(){
	int N;
	cin >> N;
	vector<int>x(N), y(N), p(N);
	REP(i, N) {
		cin >> x[i] >> y[i] >> p[i];
	}
	vector<int>cost(1ll << N, INF);
	vector<vector<int>>dp(N + 1, vector<int>(1ll << N, INF));
	REP(i, 1ll << N) {
		REP(j, N) {
			if(!(i & 1ll << j)) continue;
			int xCost = 0, yCost = 0;
			REP(k, N) {
				if(!(i & 1ll << k)) continue;
				xCost += abs(x[j] - x[k]) * p[k];
				yCost += abs(y[j] - y[k]) * p[k];
			}
			CHMIN(cost[i], min(xCost, yCost));
		}
		dp[0][i] = 0;
		REP(j, N) {
			if(i & 1ll << j)dp[0][i] += min(abs(x[j]), abs(y[j])) * p[j];
		}
	}
	REP(i, N) {
		REP(state, 1ll << N) {
			int sub = state;
			while(sub) {
				CHMIN(dp[i + 1][state], dp[i][state ^ sub] + cost[sub]);
				sub--;
				sub &= state;
			};
		}
	}
	REP(i, N + 1) out(dp[i][(1ll << N) - 1]);
}

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

int m,n;
bool check(vector<string>& flag, vector<string>& mark, int x, int y) {
	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < 2; j++) {
			int nx = x+i, ny = y+j;
			if (nx < 0 || nx >= m || ny < 0 || ny >= n) return false;
			if (flag[nx][ny] != mark[i][j]) return false;
		}
	}
	return true;
}

int main() {
	cin >> m >> n;
	vector<string> flag(m);
	for (auto& i : flag) cin >> i;
	vector<string> mark(2);
	cin >> mark[0] >> mark[1];
	int cnt = 0;
	for (int i = 0; i < m-1; i++)
		for (int j = 0; j < n-1; j++)
			if(check(flag, mark, i, j)) ++cnt;
	int maximum = 0;
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < n; j++) {
			auto bef = flag[i][j];
			int init = 0;
			for (int k = -1; k <= 0; k++)
				for (int l = -1; l <= 0; l++)
					if (check(flag, mark, i+k, j+l)) ++init;
			for (auto k : {'J', 'O', 'I'}) {
				if (bef == k) continue;
				flag[i][j] = k;
				int now = 0;
				for (int l = -1; l <= 0; l++)
					for (int m = -1; m <= 0; m++)
						if (check(flag, mark, i+l, j+m)) ++now;
				maximum = max(maximum, now-init);
			}
			flag[i][j] = bef;
		}
	}
	cout << cnt+maximum << endl;
	return 0;
}

Measured memory_bytes: 2056
#include<iostream>/*入出力関連ヘッダファイル*/
using namespace std;/*標準名前空間を利用する。cinやcoutはこれによって利用可能になる*/

int A,B,C;

int main(void) {
  cin >> A >> B >> C;
  if(A<C && C<B){
    cout << "Yes" << endl;
  }else if(B<C && C<A){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,a[100005][3],dp[100005][3],k;
int main(){
	ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
 	cin>>n;
 	for(int i=1;i<=n;i++){
        cin>>a[i][0]>>a[i][1]>>a[i][2];
 	}
 	for(int i=1;i<=n;i++){
        dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i][0];
        dp[i][1]=max(dp[i-1][0],dp[i-1][2])+a[i][1];
        dp[i][2]=max(dp[i-1][0],dp[i-1][1])+a[i][2];
 	}
 	cout<<max(max(dp[n][0],dp[n][1]),dp[n][2]);
}


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

#define fastio                  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define input_output            freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); 

#define ll                     long long
#define read1(x)                 cin>>x
#define read2(x,y)               cin>>x>>y
#define print(x)                cout<<x<<endl
#define pii                     pair<int, int>
#define pli                     pair<ll, int>
#define pil                     pair<int, ll>
#define pll                     pair<ll, ll>
#define vi                      vector<int>
#define vll                     vector<ll>
#define vb                      vector<bool>
#define vd                      vector<double>
#define vs                      vector<string>
#define ff                      first
#define ss                      second
#define pb                      push_back
#define ppb                     pop_back
#define pf                      push_front
#define ppf                     pop_front
#define vpii                    vector<pii>
#define umap                    unordered_map
#define uset                    unordered_set
#define clr(a,b)                memset(a,b,sizeof a)
#define all(ds)                 ds.begin(), ds.end()
#define rev(ds)                 ds.rbegin(), ds.rend()
#define asc(A)                  sort(A.begin(), A.end())
#define dsc(A)                  sort(A.begin(), A.end(), greater<int>())
#define gcd(x,y)                __gcd(x,y)
#define clr(a,b)                memset(a,b,sizeof a)
#define fr(i, n)                for(int i=0; i<n;++i)
#define fr1(i, n)               for(int i=1; i<=n; ++i)
#define rfr(i, n)               for(int i=n-1; i>=0; --i)
#define printVector(v)          for(int i= 0;i<v.size();i++) {cout<<v[i]<<" ";} cout<<endl;
#define precise(x)              cout<<fixed<<setprecision(x)
#define inf                     10000000000000

 

ll lcm(ll a, ll b) {return (a*b)/__gcd(a, b); }
ll power(ll x, ll y, ll m) { if(!y) return 1; ll p=power(x, y>>1, m)%m; p=p*p%m; return (y&1)?(x*p)%m:p;}
ll modInverse(ll a, ll m){ return power(a, m-2, m); }
bool isPrime(ll num){bool flag=true;for(ll i =2;i<=num/2;i++){if(num%i==0) {flag=false; break;} }return flag;}
ll sumofdigits(ll n){ll c=0;while(n>0){c++;n/=10;}return c;}
bool sortinrev(const pair<int,int>&a,const pair<int,int>&b) {return a.first > b.first; }
bool sortbysec(const pair<int,int> &a, const pair<int,int> &b) {return a.second < b.second; }

//const double PI= 2*acos(0.0);
const long long MOD= 1000000007;



void solve(){
    int k; cin>>k;
    ll ans = -1, seven = 0;
    for(int i = 1; i <= (1e7); ++i){
        seven = (seven*10 + 7)%k;
        if(seven == 0){
            ans = i;
            break;
        }
    }
    print(ans);
}
int main()
{
#ifndef ONLINE_JUDGE  
    input_output  
#else   
    fastio
#endif

    int t =1 ;
    // cin>>t;
    while(t--){
        solve();
    }

    return 0;
}

Measured memory_bytes: 3656
#include<iostream>
#include <string>
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define endl "\n"
#define sz(v) (int)(v.size())
#define len(s) (int)(s.length())
#define M 1000000007
#define all(v) v.begin(),v.end()
#define fr(a,b,c) for(ll i=a;i<=b;i+=c)
#define inarr(arr,n); for(ll i=0;i<n;i++) cin >> arr[i];
#define outarr(arr,n); for(ll i=0;i<n;i++) cout<<arr[i]<<" ";
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const ll inf = 9e18;
const ld pi = 2*acos(0.0); 
using namespace std;
ll power(ll a,ll n) 
{
    if(n==0){
        return 1;
    }
    ll p=power(a,n/2) % M;
    p = (p * p) % M;
    if (n%2==1)
    {
        p=(p*a)%M;
    }
    return p;
}
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
}
const int N=1e6+5;
vector <ll> sieve(N,0); 
void si() 
{
    sieve[1]=1;
    for(int i=2;i<N;i++){
        if(sieve[i]==0){
            for(int j=i;j<N;j+=i){
                sieve[j]=i;
            }
        }
    }
}
int isprime(ll n){
    for(ll i=2;i<=sqrt(n);i++){
        if(n%i==0){
            return 0;
        }
    }
    return 1;
}
int main(){
    ios;
    ll n,m,x;
    cin>>n>>m>>x;
    vector <ll> c(n);
    vector <vector <ll> > a(n,vector <ll> (m));
    for(int i=0;i<n;i++){
        cin>>c[i];
        for(int j=0;j<m;j++){
            cin>>a[i][j];
        }
    }
    ll loop=pow(2,n)-1;
    ll ans=1e18;
    for(int i=0;i<=loop;i++){
        vector <ll> done(m,0);
        ll cost=0;
        for(int j=0;j<n;j++){
            ll z=pow(2,j);
            if(((z)&(i))){
                cost+=c[j];
                for(int k=0;k<m;k++){
                    done[k]+=a[j][k];
                }
            }
        }
        int flag=1;
        for(int j=0;j<m;j++){
            if(done[j]<x){
                flag=0;
                break;
            }
        }
        if(flag){
            ans=min(ans,cost);
        }
    }
    if(ans==1e18){
        cout<<-1<<endl;
    }
    else{
        cout<<ans<<endl;
    }
    return 0;
}

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

#define MAXN 100100
#define MOD 1000000007
#define fak {cout<<0;return 0;}

int a[MAXN], cnt[MAXN];
int rj = 1;

int main()
{
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n / 2; i++) {
    rj *= 2;
    rj %= MOD;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    cnt[a[i]]++;
  }
  if (n & 1) {
    if (cnt[0] != 1) fak
    for (int i = 2; i <= n - 1; i += 2)
      if (cnt[i] != 2)
        fak
    cout << rj; return 0;
  }
  else {
    for (int i = 1; i <= n - 1; i += 2)
      if (cnt[i] != 2)
        fak
    cout << rj; return 0;
  }
  return 0;
}


Measured memory_bytes: 1024
s=input()
d=[0]*13
d[0]=1
for i in s:
    dnew=[0]*13
    if i=="?":
        for j in range(10):
            for k in range(13):
                dnew[(10*k+j)%13]+=d[k]
            for k in range(13):
                dnew[k]%=(10**9+7)
    else:
        for k in range(13):
            dnew[(10*k+int(i))%13]+=d[k]
        for k in range(13):
            dnew[k]%=(10**9+7)
    d=dnew

print(d[5])


Measured memory_bytes: 44636
import heapq

n = int(input())
arr = list(map(int,input().split()))

arr.sort()
arr.reverse()

que = [0]
heapq.heapify(que)

ans = 0

for i in range(n):
    top = heapq.heappop(que)
    top = -top
    ans += top
    if i == 0:
        heapq.heappush(que, -arr[i])
    else:
        heapq.heappush(que,-arr[i])
        heapq.heappush(que,-arr[i])

    # print(que)

print(ans)



Measured memory_bytes: 99988
#include <iostream>
#include <vector>
#include <string>

using namespace std;

vector<string> try4(int N, int M, int A, int B){
    if(N%2 == 0 || M%2 == 0 || N < 3 || M < 3 || A < 2 || B < 2) return vector<string>();
    vector<string> res(N, string(M, '.'));
    res[N-3][M-3] = res[N-1][M-2] = '<';
    res[N-3][M-2] = res[N-1][M-1] = '>';
    res[N-3][M-1] = res[N-2][M-3] = '^';
    res[N-2][M-1] = res[N-1][M-3] = 'v';
    A -= 2;
    B -= 2;
    for(int i=0;i+1<M-3 && A;i+=2){
        res[N-1][i] = '<';
        res[N-1][i+1] = '>';
        --A;
    }
    for(int j=0;j+1<N-3 && B;j+=2){
        res[j][M-1] = '^';
        res[j+1][M-1] = 'v';
        --B;
    }
    --N; --M;
    for(int i=0;i<N;i+=2){
        for(int j=0;j<M;j+=2){
            if(i+2 == N && j+2 == M) continue;
            if(A > 0){
                res[i][j] = '<';
                res[i][j+1] = '>';
                --A;
                if(A > 0){
                    res[i+1][j] = '<';
                    res[i+1][j+1] = '>';
                    --A;
                }
            } else if(B > 0){
                res[i][j] = '^';
                res[i+1][j] = 'v';
                --B;
                if(B > 0){
                    res[i][j+1] = '^';
                    res[i+1][j+1] = 'v';
                    --B;
                }
            }
        }
    }
    if(A > 0 || B > 0) return vector<string>();
    return res;
}

vector<string> solve(int N, int M, int A, int B){
    {
        auto r = try4(N, M, A, B);
        if(!r.empty()) return r;
    }
    vector<string> res(N, string(M, '.'));
    if(N%2 == 1){
        for(int i=0;i+1<M && A;i+=2){
            res[N-1][i] = '<';
            res[N-1][i+1] = '>';
            --A;
        }
        --N;
    }
    if(M%2 == 1){
        for(int i=0;i+1<N && B;i+=2){
            res[i][M-1] = '^';
            res[i+1][M-1] = 'v';
            --B;
        }
        --M;
    }
    if(2*(A+B) > N*M) return vector<string>();
    for(int i=0;i<N;i+=2){
        for(int j=0;j<M;j+=2){
            if(A > 0){
                res[i][j] = '<';
                res[i][j+1] = '>';
                --A;
                if(A > 0){
                    res[i+1][j] = '<';
                    res[i+1][j+1] = '>';
                    --A;
                }
            } else if(B > 0){
                res[i][j] = '^';
                res[i+1][j] = 'v';
                --B;
                if(B > 0){
                    res[i][j+1] = '^';
                    res[i+1][j+1] = 'v';
                    --B;
                }
            }
        }
    }
    if(A > 0 || B > 0) return vector<string>();
    return res;
}

int main(){
    int N, M, A, B; cin >> N >> M >> A >> B;
    auto res = solve(N, M, A, B);
    cout << (res.empty() ? "NO" : "YES") << endl;
    for(auto& s : res) cout << s << endl;
}


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

const int N=400005;
int cnt,h[N],to[N],las[N],c[N];
int vis[N],val[N],n,m,u,v,w;

void dfs(int x)
{
	vis[x]=1;
	int i;
	for(i=h[x];i;i=las[i])
	    if(!vis[to[i]])
	    {
	    	val[to[i]]=val[x]+c[i];
	    	dfs(to[i]);
	    }
	    else if(val[to[i]]!=val[x]+c[i])
	    {
	    	printf("No");
	    	exit(0);
	    }
}

int main()
{
	scanf("%d%d",&n,&m);
	int i;
	for(i=1;i<=m;i++)
	{
		scanf("%d%d%d",&u,&v,&w);
		las[++cnt]=h[u],h[u]=cnt,to[cnt]=v,c[cnt]=w;
		las[++cnt]=h[v],h[v]=cnt,to[cnt]=u,c[cnt]=-w;
	}
	for(i=1;i<=n;i++)
	    if(!vis[i])
	        dfs(i);
	printf("Yes");
	return 0;
}


Measured memory_bytes: 10240
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iomanip>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;

template<typename T>
vector<T> make_vec_nd(T init, size_t size) {
    return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, size_t size, Args... rest) {
    auto inner = make_vec_nd(init, rest...);
    return vector<decltype(inner)>(size, inner);
}

int main() {
    ll N;
    cin >> N;
    string s;
    cin >> s;
    auto dp = make_vec_nd((ll)0, N, N);
    for (ll i = 0; i < N; i++) {
        for (ll j = 0; j < N; j++) {
            if (s[i] != s[j]) {
                dp[i][j] = 0;
            } else {
                if (i > 0 && j > 0) {
                    dp[i][j] = dp[i-1][j-1] + 1;
                } else {
                    dp[i][j] = 1;
                }
            }
        }
    }
    ll ans = numeric_limits<ll>::min();
    for (ll i = 0; i < N; i++) {
        for (ll j = 0; j < N; j++) {
            ans = max(ans, min(dp[i][j], abs(i-j)));
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 195840
n,m,r=gets.split.map(&:to_i)
r-=n*m
if r<0 then
  puts 0
else
  def fact(x)
    r=1
    (1..x).each do |i|
      r*=i
    end
    r
  end
  puts fact(r+n-1)/fact(r)/fact(n-1)
end

Measured memory_bytes: 10236
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF LLONG_MAX
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll n; cin >> n;
    ll min_path = INF;
    for (ll a = 1; a <= sqrt(n); a++) {
        if (n % a) continue;
        ll path = a + (n / a) - 2;
        if (min_path > path) {
            min_path = path;
        }
    }
    cout << min_path << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N =sc.nextInt();
    String S =sc.next();
    
    int ans = 0;
    for(int i = 1; i < N; i++) {
      Set<String> front = new HashSet<>(Arrays.asList(S.substring(0, i).split("")));
      Set<String> back = new HashSet<>(Arrays.asList(S.substring(i, N).split("")));
      int count = 0;
      for(String value: front) {//
        if (back.contains(value)) {
          count++;
        }
      }
      if (count > ans) {
        ans = count;
      }
    }
    System.out.println(ans);
  }
}
 
    
    

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

int main(){
    int flag;
    int n,p,sn=0;
    int ans=0;

    cin >>n;
    p=n;

    while (p>0){
        sn += (p%10);
        p /= 10;
    }

    if(n % sn ==0)flag=1;
    else flag=0;
    
    //cout << ans <<endl;
    //cout <<fixed<<setprecision(16)<< ans <<endl;

    if(flag==1)cout << "Yes" <<endl;
    else cout << "No" <<endl;
    
    return 0;
}


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

int min(int a, int b){
	return (a > b)? b : a;
}

int main(){
	/*input*/
	int a, b, k;	cin >> a >> b >> k;
	/*calculation*/
	int o[100] = {0};
	for(int i = 1, j = 0; i <= min(a, b); i++){
		if(a%i == 0 && b%i == 0){
			o[j++] = i;
		}
	}
	int i = 0;
	int length = 0;	//配列の長さ
	while(o[i++]){
		length++;
	}
	/*output*/
	cout << o[length - k] << endl;

	return 0;
}


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

pint p[200001];
vector<int> v0,v1;
const int mod=1000000007;
int main(){
    int n,m,ai;
    cin>>n;
    rep(i,n){
        cin>>ai;
        p[i]={ai,0};
    }
    rep(i,n){
        cin>>ai;
        p[i+n]={ai,1};
    }
    sort(p,p+n+n);
    ll mul=1;
    rep(i,n+n){
        if(p[i].second==0){
            if(!v1.empty()){
                mul*=v1.size();v1.pop_back();
                mul%=mod;
            }
            else v0.pb(i);
        }
        else{
            if(!v0.empty()){
                mul*=v0.size();v0.pop_back();
                mul%=mod;
            }
            else v1.pb(i);
        }
    }
    cout<<mul<<endl;
    return 0;
}

Measured memory_bytes: 2428
#include <bits/stdc++.h>
#define loop(n) for(ll i=0;i<n;i++)
#define loopj(n) for(ll j=0;j<n;j++)
#define loopR(i,a,b,c) for(ll i=a;i>=b;i-=c)
#define rng(i,a,b,c) for(ll i = a; i<b;i+=c)
#define loop2(i,a,b) for(long long i = a; i>=b;i--)
#define loop3(j,a,b) for(int j = a; j<b;j++)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long   
#define ld long double
#define SET set<ll>
#define pb push_back
#define mp make_pair
#define gc getchar_unlocked

using namespace std; 

//cout<<setprecision(4) << fixed;
/*int compare(string str1, string str2){
   if(str1.length() < str2.length())
   return 1;
   return 0;
}*/
/* int to string-
int c=0;
stringstream ss;
ss<<c;
string str=ss.str();*/
/* STRING TO INT
string s;
	cin>>s;
	reverse(s.begin(),s.end());
	stringstream ss(s);
	ll a=0;
	ss>>a;*/
//about maps
/*unordered_map <int,int> g;
 
    i1 = std::min_element(v + 2, v + 5); 
    cout<<*i1;
 
//getline

cin.ignore();
getline(cin,s);    

*/
// no getchar_unlocked on Windows so call _getchar_nolock
/*

 ll lcm(ll a, ll b)  
 {  
    return (a*b)/__gcd(a, b);  
 }  

inline int getchar_unlocked() { return _getchar_nolock(); }
inline ll read() {  
 ll n=0;  
 char p=getchar_unlocked();  
 while((p<'0'||p>'9')&&p!=EOF)  
 p=getchar_unlocked();  
 while(p>='0'&&p<='9')  
 {  
 n = (n<< 3) + (n<< 1) + (p - '0');  
 p=getchar_unlocked();}  
 return n;
}

void dfs(vector<ll> adj[],ll vis[],ll u)
{

	if(vis[u]==0)
	{
		cout<<u<<' ';
		vis[u]=1;
		for(auto x:adj[u])
		{
			if(vis[x]==0 )
			{
			dfs(adj,vis,x);
		    }
		}
	}
}
*/



void go()
{
ll n;

cin>>n;

if(n==0)
cout<<1;
else
cout<<0;


}





int main() 
{ 
/*
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/	
	
int t;

fast;

//cin>>t; 

//loop(t)
go();
}

Measured memory_bytes: 3608
#include<iostream>
#include<algorithm>
#include<vector>
#define REP(i,a) for(int i=0;i<(a);i++)
#define RREP(i,a) for(int i=(a);i>=0;i--)
#define CHK(x,a) for(int x:(a))
typedef long long ll;
using namespace std;


int main()
{
	int N,a[100],t[]={0,0};
	cin >> N;
	REP(i, N) cin >> a[i];
	sort(a, a + N,greater<int>());
	REP(i, N) {
		if (!(i % 2)) t[0] += a[i];//Alice
		else t[1] += a[i];//Bob
	}
	cout << (t[0] - t[1]) << endl;
}


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

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;


static const long long mod = 1000000007;

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n;
  cin >> n;

  rep(i, 200) rep(j, 200){
    ll a5 = i*i*i*i*i;
    ll b5 = j*j*j*j*j;
    if(a5 - b5 == n) {
      cout << i << " " << j << endl;
      return 0;
    }
    if(a5 + b5 == n) {
      cout << i << " " << -j << endl;
      return 0;
    }    
  }

  return 0;
}


Measured memory_bytes: 3632
*> REF ABC 170 A
IDENTIFICATION DIVISION.
PROGRAM-ID. PROGRAM_ID.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 S          PIC X(3).
01 n          PIC 9.
01 ans        PIC 9(10).
01 zs         PIC Z(9)9.
01 w1         PIC X(21) VALUE "SUNMONTUEWEDTHUFRISAT".
01 REDEFINES w1.
  03 w      PIC X(3) OCCURS 7 INDEXED BY ix.

PROCEDURE DIVISION.
  ACCEPT S.
  MOVE 7 TO n.
  PERFORM UNTIL n < ix
    SEARCH w VARYING ix
      AT END
        CONTINUE
      WHEN S = w(ix)
        MOVE ix TO ans
        SET ix UP BY 1
    END-SEARCH
  END-PERFORM.
  COMPUTE ans = 7 - (ans - 1).
  MOVE ans TO zs.
  DISPLAY FUNCTION TRIM(zs).
  STOP RUN.


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

#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#define itrout(x) for(int i=0;i<x.size();i++) {cout << x[i] << (i==x.size()-1 ? "\n" : " ");}
#ifdef LOCAL
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define debugbit(x, n) cerr << #x << " = " << bitset<n>(x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define itrdebug(x) cerr << #x << " "; for (auto & el : (x)) {cerr << (el) << " ";} cerr << endl
#define dassert(...) assert(__VA_ARGS__)
#else
#define debug(x)
#define debugbit(x, n)
#define itrdebug(x)
#define dassert(...)
#endif
//#define int long long

typedef long long ll;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-8;

void solve(long long a, long long b, long long c, long long d){
    vector<ll> answers;
    answers.push_back(a*c);
    answers.push_back(a*d);
    answers.push_back(b*c);
    answers.push_back(b*d);
    cout << *max_element(all(answers)) << endl;
}

signed main(){
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    long long a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    long long c;
    scanf("%lld",&c);
    long long d;
    scanf("%lld",&d);
    solve(a, b, c, d);
    return 0;
}


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

int main () 
{
    int N, M, X;
    std::cin >> N >> M >> X;
    int left=0, right=0;
    
    int A[110]={0};
    for (int i = 0; i < M; i++) 
    {
        int temp;
        std::cin >> temp;
        A[temp] = 1;
    }
    
    for (int i = 0; i < X; i++) 
    {
        left += A[i];
    }
    for (int i = X+1; i < N; i++) 
    {
        right += A[i];
    }
    
    std::cout << min(left, right) << std::endl;
    
    return 0;
}

Measured memory_bytes: 256
import sys

line = sys.stdin.readline().strip()
n, m = map(int, line.split())
nums = [-1]*n
for _ in range(m):
    line = sys.stdin.readline().strip()
    pos, val = map(int, line.split())
    if n > 1 and pos == 1 and val == 0:
        print(-1)
        sys.exit(0)
    pos -= 1
    if nums[pos] != -1 and val != nums[pos]:
        print(-1)
        sys.exit(0)
    nums[pos] = val
if nums[0] == -1:
    if n > 1:
        nums[0] = 1
    else:
        nums[0] = 0
for i in range(1, n):
    if nums[i] == -1:
        nums[i] = 0
print("".join(map(str,nums)))

Measured memory_bytes: 3064