akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
#define mp  std::make_pair
#define ll long long int
#define abs(n) ((n>0)?(n):((n)*(-1)))
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define VREP(v) for(std::vector<ll>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VALL(v) ((v).begin(),(v).end())
#define errln(v) cerr << (v) << endl;
#define println(v) cout << (v) << endl;

int main(int argc, const char * argv[]) {
	int N;
	cin >> N;
	ll A;
	bool bits[N][20];
	int LastFlagOfDigit[20];
	REP(i,20) LastFlagOfDigit[i] = -1;
	ll cnt=0;
		int l_1 = -1; // enough large
	REP(i,N){
		cin >> A;
		REP(j,20) bits[i][j] = (A & (1LL << j));
//		REP(j,20) printf("%d",(bits[i][j]) ? 1 : 0);
		REP(j,20){
			if(bits[i][j]) l_1 = max(l_1, LastFlagOfDigit[j]);
			if(bits[i][j]) LastFlagOfDigit[j]=i;
		}
//		printf(" ---> %d -- %d  ---> %d \n",l_1+1,i,i-l_1);
		cnt += (i-l_1);
	}
	println(cnt);
}


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

int main()
{
   long long n,p=0,i;
   cin>>n;
   for(i=1;i<=n;i++)
   {
       if(i%3==0||i%5==0)
        continue;
       else{
        p+=i;
       }
   }
  cout<<p<<endl;
    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define digit(x) floor(log10(x))+1
#define mod 1000000007
#define L_MAX 1e18
using ll = long long;
using ld = long double;
using ii = pair<ll,ll>;
using iii = tuple<ll,ll,ll>;
using matrix = vector<vector<ll>>;
using arr = vector<ll>;
using vs = vector<string>;
using pv = vector<ii>;
using umap = unordered_map<ll,ll>;
#define in1(x) scanf("%lld",&x)
#define in2(x,y) scanf("%lld %lld",&x,&y)
#define in3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define all(x) x.begin(),x.end()
#define debug(x) cerr << #x << " is " << x << endl;
void showArr(arr a){
    for(auto i : a) cout<<i<<" ";
    cout<<endl;
}
ll dx[]={-1,1,-1,1,0,0,-1,1};
ll dy[]={-1,1,0,0,-1,1,1,-1};
ll Solve(ll index,ll n,arr w,arr v,ll w1,ll dp[][1000]){
    if(index>=n || w1<=0)
        return 0;
    if(dp[index][w1]!=-1)
        return dp[index][w1];
    ll taken=0;
    if(w[index]<=w1){
        dp[index+1][w1-w[index]]=Solve(index+1,n,w,v,w1-w[index],dp);
        taken+=v[index]+dp[index+1][w1-w[index]];
    }
    dp[index+1][w1]=Solve(index+1,n,w,v,w1,dp);
    return dp[index][w1]=max(dp[index+1][w1],taken);
}
void max_self(ll &a,ll b){
    a = max(a,b);
}
int main(){
    fast;
    ll n,w1;
    cin>>n>>w1;
    arr v,w;
    for(int i=0;i<n;i++){
        ll x,y;
        cin>>x>>y;
        w.pb(x);
        v.pb(y);
    }
    ll dp[100001]={0};
   //  unordered_map<ii,bool>x; //First is weight Second is index that are taken;
   // memset(dp,-1,sizeof(dp));
   // cout<<Solve(0,n,w,v,w1,dp)<<endl;
   /* for(int i=0;i<=w1;i++){
        dp[i]=0;
        for(int k=0;k<n;k++){
            if(w[k]<=i){
                max_self(dp[i],dp[i-w[k]]+v[k]);
            }
        }
       // cout<<dp[i]<<" ";
    }*/
    for(int i=0;i<n;i++){
        for(int j=w1;j>=w[i];j--){
            max_self(dp[j],dp[j-w[i]]+v[i]);
        }
    }
   // cout<<"\n";
    cout<<dp[w1]<<endl;
    return 0;
}

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

ll sum(int l, int r) {
    return ll(l+r)*(r-l+1)/2;
}

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

    ll ans = 0;
    for (int i = k; i <= n+1; i++) {
        ll min_sum = sum(0, i-1);
        ll max_sum = sum(n-i+1, n);
        ll t = max_sum - min_sum + 1;
        ans += t % (1000000000 + 7);
    }

    cout << ans % (1000000000+7) << endl;

    return 0;
}

Measured memory_bytes: 3540
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;

const int mx=200010;
const ll mod=1e9+7;

int n;
ll a,b,ans=0,c[mx];

int main(){
  cin >> n;
  for(int i=0; i<n; i++){
    cin >> a >> b;
    c[i] = a+b;
    ans -= b;
  }
  
  sort(c,c+mx);
  reverse(c,c+mx);
  
  for(int i=0; i<n; i+=2){
    ans += c[i];
  }

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

Measured memory_bytes: 1792
import sys


n, k = [int(_) for _ in input().split()]
if k == 0:
    print(n*n)
    sys.exit()
ans = 0
m = n-k
t1 = 0
t2 = 0
t3 = 0
ans += ((m*m - m) // 2) + m
for i in range(k+1, n+1):
    t1 = n-i+1
    t2 = t1 // i
    t3 = t1 % i
    ans += t2 * (i-k)
    if t3 > k:
        ans += t3 - k
print(ans)

Measured memory_bytes: 3064
use std::cmp::max;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
.split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn main() {
    // solver code...
    let tmp_vec = read_vec::<i64>();
    let mut ans = -1 * (10_i64.pow(18));
    for x in 0..2 {
        for y in 2..4 {
                let tmp_ans = tmp_vec[x] * tmp_vec[y];
                ans = max(ans, tmp_ans);
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 2124
n = int(input())
sticks = list(map(int, input().split()))
s = sum(sticks)

a = []
sum_i = 0
for i, v in enumerate(sticks):
  sum_i += v
  if i == len(sticks) - 1:
    continue
  a.append(abs(s - 2*sum_i))

print(min(a))

  

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

using namespace std;

#define FOR(i,n) for(int i=0; i<n; ++i)
#define FORR(i,a,n) for(int i=a; i<n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

const int INF = 0x3f3f3f3f;

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
 
//int in() { int x; scanf("%d", &x); return x; }
//ll lin() { ll x; scanf("%lld", &x); return x; }
void printfv(VI a){ int n = a.size(); FOR(i, n) cout << a[i] << " "; }

int main(void){

	int n;
	cin >> n;

	int ans = min(n, 9);
	ans += min(max(n - 99, 0), 900);
	ans += min(max(n - 9999, 0), 90000);
	//ans += min(max(n - 999999, 0), 9000000);

	cout << ans;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stdlib.h>
#include <map>
#include <cmath>
#define MOD_P 1000000007
#define MOD_Q 998244353
#define PI 3.14159265358979
#define ll long long
using namespace std;

bool isPrime(int x)
{
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) {
			return false;
		}
	}

	return true;
}

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

	while (!isPrime(n)) {
		n++;
	}

	printf("%d", n);

	return 0;
}



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

int main(){
  int N;cin>>N;
  vector<int> d(N);
  for(int i=0;i<N;i++) cin>>d[i];
  int ans =0;
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      ans+=d[i]*d[j];
    }
  }
  cout<<ans<<endl;
}
    

Measured memory_bytes: 256
import Control.Applicative

createRows :: Int -> Int -> Int -> [String]
createRows n h w
    | n > h          = []
    | n `mod` 2 == 1 = (take w . concat $ repeat "#.") : createRows (n + 1) h w
    | otherwise      = (take w . concat $ repeat ".#") : createRows (n + 1) h w

main :: IO()
main = do
    args <- (map (read :: String -> Int) . words) <$> getLine
    if (args == [0, 0])
    then return ()
    else do
        (putStrLn . unlines) $ createRows 1 (args !! 0) (args !! 1)
        main

Measured memory_bytes: 4188
import java.io.*;
import java.util.*;
public class Main
{
	
	private void solve()throws IOException
	{
		int n=nextInt();
		int l=nextInt();
		int ans=-1;
		int a[]=new int[n+1];
		for(int i=1;i<=n;i++)
		{
			a[i]=nextInt();
			if(i!=1 && a[i]+a[i-1]>=l)
				ans=i-1;
		}
		if(ans==-1)
			out.println("Impossible");
		else
		{
			out.println("Possible");
			for(int i=1;i<ans;i++)
				out.println(i);
			for(int i=n-1;i>ans;i--)
				out.println(i);
			out.println(ans);
		}
	}

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

	public void run()throws IOException
	{
		br=new BufferedReader(new InputStreamReader(System.in));
		st=null;
		out=new PrintWriter(System.out);

		solve();
		
		br.close();
		out.close();
	}
	public static void main(String args[])throws IOException{
		new Main().run();
	}
	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	String nextToken()throws IOException{
		while(st==null || !st.hasMoreTokens())
		st=new StringTokenizer(br.readLine());
		return st.nextToken();
	}
	String nextLine()throws IOException{
		return br.readLine();
	}
	int nextInt()throws IOException{
		return Integer.parseInt(nextToken());
	}
	long nextLong()throws IOException{
		return Long.parseLong(nextToken());
	}
	double nextDouble()throws IOException{
		return Double.parseDouble(nextToken());
	}
}

Measured memory_bytes: 44236
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<climits>
#include<cfloat>
#define curr(P, i) P[(i) % P.size()]
#define next(P, i) P[(i+1) % P.size()]
#define prev(P, i) P[(i+P.size()-1) % P.size()]

using namespace std;

typedef double Real;

Real EPS = 1e-8;
const Real PI = acos(-1);

int sgn(Real a, Real b=0){return a<b-EPS?-1:a>b+EPS?1:0;}
Real sqr(Real a){return sqrt(max(a,(Real)0));}

struct Point{
  Real add(Real a, Real b){
    if(abs(a+b) < EPS*(abs(a)+abs(b)))return 0;
    return a+b;
  }
  Real x, y;
  Point(){}
  Point(Real x,Real y) : x(x) , y(y){}
  Point operator - (Point p){return Point(add(x,-p.x), add(y,-p.y));}
};

Real dot(Point a, Point b) {return (a.x*b.x+a.y*b.y);}
Real cross(Point a, Point b) {return (a.x*b.y-a.y*b.x);}

struct Polygon{
  vector<Point>v;

  Polygon(){}
  Polygon(int n){v.resize(n);}

  int contain(Point p){
    bool in=false;
    for(int i=0;i<v.size();i++){
      Point a=curr(v,i)-p,b=next(v,i)-p;
      if(a.y>b.y)swap(a,b);
      if(a.y<=0 && 0<b.y && cross(a,b)<0)in=!in;
      if(cross(a,b)==0 && dot(a,b)<=0)return 2;
    }
    return in?1:0;
  }
};

int main(void){

  Polygon pol(3);
  Point p;
  while(cin >> pol.v[0].x >> pol.v[0].y){
    for(int i=1;i<3;i++)cin >> pol.v[i].x >> pol.v[i].y;
    cin >> p.x >> p.y;
    
    if(pol.contain(p))cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;

int q,a,b,c;
deque<int> A; 
int main(void){
    cin >> q;
    rep(i,q) {
        cin >> a >> b;
        switch(a) {
            case 0:
            cin >> c;
            if(b)   A.push_back(c);
            else    A.push_front(c);
            break;
            case 1:
            cout << A[b] << endl;
            break;
            case 2:
            if(b)    A.pop_back();
            else     A.pop_front();
            break;
        }
    }
}


Measured memory_bytes: 4612
#include<iostream>
#include<cstdio>
using namespace std;
char s[100];
void solve(int l,int r,char c1,char c2)
{
	int mid=l+r>>1,len=mid-l;
	printf("%d\n",mid);
	fflush(stdout);
	scanf("%s",s);
	if(s[0]=='V'){exit(0);}
	if(len&1)
	{
		if(s[0]!=c1)solve(l,mid-1,c1,s[0]);
		else solve(mid+1,r,s[0],c2);
	}
	else
	{
		if(s[0]==c1)solve(l,mid-1,c1,s[0]);
		else solve(mid+1,r,s[0],c2);
	}
}
int main()
{
	int n;scanf("%d",&n);
	int mid=n>>1;
	puts("0");
	fflush(stdout);
	scanf("%s",s);
	if(s[0]=='V'){exit(0);}
	char c1=s[0];
	printf("%d\n",n-1);
	fflush(stdout);
	scanf("%s",s);
	if(s[0]=='V'){exit(0);}
	char c2=s[0];
	solve(1,n-2,c1,c2);
	return 0;
}

Measured memory_bytes: 852
#include<stdio.h>

#define MAX 100005
#define NIL -1

struct Node_struct{int p, l, r;};
typedef struct Node_struct Node;
Node T[MAX];
int D[MAX];

void print(int u){
  int i, c;
  printf("node %d: parent = %d, depth = %d, ", u, T[u].p, D[u]);

  if(T[u].p == NIL) printf("root, ");
  else if(T[u].l == NIL) printf("leaf, ");
  else printf("internal node, ");

  printf("[");
  for (i=0, c = T[u].l; c != NIL; i++, c = T[c].r){
    if(i) printf(", ");
    printf("%d", c);
  }
  printf("]\n");

}

void calcDepth(int u, int p){
  D[u] = p;
  if(T[u].l != NIL) calcDepth(T[u].l, p+1);
  if(T[u].r != NIL) calcDepth(T[u].r, p);
}

int main(){
  int i, j, k;
  int n;
  int id, sib, child;
  int root = NIL;
  scanf("%d", &n);
  for(i=0; i<n; i++) T[i].p = T[i].l = T[i].r = NIL;

  for(i=0; i<n; i++){
    scanf("%d %d", &id, &k);
    for(j = 0, sib = NIL; j<k; j++){
      scanf("%d", &child);
      T[child].p = id;
      if(j == 0) T[id].l = child;
      else T[sib].r = child;
      sib = child;
    }
  }
  for(i=0; i<n; i++){
    if(T[i].p == -1) root = i;
  }
  calcDepth(root, 0);
  for(i=0; i<n; i++) print(i);

  return 0;
}



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

int main(){
  int N;
  cin >> N;
  char S[N];
  for(int i=0;i<N;i++){
    cin >> S[i];
  }
  char c = S[0];
  int count = 0;
  for(int i=1;i<N;i++){
    if(c == S[i]){
        count++;
    }else{
    }
    c=S[i];
  }
  cout << N-count;
}


Measured memory_bytes: 384
#include <bits/stdc++.h> 
#include <algorithm>
#define ll  long long int
#define m 1000000007
using namespace std;
int a[15]={0},n,ans=0;
vector<pair<int,int>> p[100];
void func(int k)
{
	//cout<<k<<endl;
	int i,j;
	if(k==n)
	{
		/*for(i=0;i<n;i++)
			cout<<a[i]<<" ";
		cout<<endl;*/
		int c=0;
		for(i=0;i<n;i++)
		{
			if(a[i]==1)
			{
				for(pair<int,int> pr:p[i])
				{
					int f=pr.first-1,l=pr.second;
					if(a[f]!=l)
						return;
				}
				c++;
				//cout<<"came here\n";
			}
		}
		ans=max(ans,c);
		//cout<<"success\n";
		return;
	}
	
	a[k]=0;
	func(k+1);
	a[k]=1;
	func(k+1);
}
int main() 
{		
	int ele,i,j;
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>ele;
		for(j=0;j<ele;j++)
		{
			int f,l;
			cin>>f>>l;
			p[i].push_back({f,l});
		}
	}
	func(0);
	cout<<ans<<endl;
	
	
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define pb push_back
#define fi first
#define se second 
#define mp make_pair
int main()
{
    IOS
    int a,p; cin>>a>>p;
    int ans = (3*a+p)/2;
    cout<<ans<<endl;
    return 0;
}

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

int main(){
    priority_queue<int> q;
    while (1){
        string s;
        cin >> s;
        if(s=="end"){
            break;
        }
        if(s=="extract"){
            cout << q.top() << endl;
            q.pop();
        }
        else{
            int n;
            cin >> n;
            q.push(n);
        }
    }
}


Measured memory_bytes: 6988
#include <iostream>
#include <vector>
#include <unordered_set>
#include <algorithm>
#include <cmath>

using namespace std;

template <int base>
int digit_sum(int n)
{
	int sum = 0;
	while (n > 0) {
		sum += n % base;
		n /= base;
	}
	return sum;
}

using ivec = vector<int>;

ivec read_int_args()
{
	int N;
	cin >> N;
	ivec v(N);
	for (auto& e : v) {
		cin >> e;
	}
	return v;
}

int compar(const void * b, const void* a)
{
	return (*(int*)a - *(int*)b );
}

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

int main()
{
	string S;
	cin >> S;
	
	int len = S.length();
	long sum = 0;
	for (int b = 0; b < (1<<len-1);b++) {
		long t = 0;
		long n = S[0] - '0';
		for (int i = 0; i < len - 1; i++) {
			if (b & (1 << i)) {
				t += n;
				n = 0;
			} else {
				n *= 10;
			}
			n += S[i+1] - '0';
		}
		
		sum += t + n;
	}
	cout << sum << endl;

	return 0;
}


Measured memory_bytes: 256
from sys import stdin
N = int(stdin.readline().rstrip())
data = [int(x) for x in stdin.readline().rstrip().split()]
ans1 = max(data)
ans2 = 0
sa = 10**9
for i in data:
    if (abs((ans1//2)-i) < sa) and (i < ans1):
        ans2 = i
        sa = abs((ans1//2)-i)
print(ans1,ans2)

Measured memory_bytes: 14056
(let* ((n (read))
       (m (read))
       (lst1 (loop repeat n
                   collect (cons (read) (read))))
       (lst2 (loop repeat m
                   collect (cons (read) (read)))))

  (defun f (p q)
    (+ (abs (- (car p) (car q))) (abs (- (cdr p) (cdr q)))))


  (setq lst3
        (loop for i from 0 to (1- (length lst1))
              collect (loop for j from 0 to (1- (length lst2))
                            collect (f (nth i lst1) (nth j lst2)))))

  ;(format t "lst1: ~A~%" lst1)
  ;(format t "lst2: ~A~%" lst2)
  ;(format t "lst3: ~A~%" lst3)


  (format t "~{~A~%~}"
          (loop for i in lst3
                collect (1+ (position (apply #'min i) i)))))



Measured memory_bytes: 24608
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")



n = int(input())
l = [chr(v) for v in range(ord("a"), ord("z")+1)]

ans = []
while n>0:
    n -= 1
    i,j = n//26, n%26
    ans.append(l[j])
    n = i
# ans.append(l[n])
print("".join(ans[::-1]))

Measured memory_bytes: 61788
#include <stdio.h>

void trace(int A[],int N,int count){
  int i ;
  for (i = 0; i < N ; i++){
    if (i > 0) printf(" ");
    printf("%d" , A[i]);
  }
  printf("\n");
  printf("%d\n", count);
}

void bubblesort(int A[],int N,int count){
  int i ,j;
  int tmp;

  for(i = N ; i > 0; i-- ){
    for(j = N-1; j > N-i; j--){
      if(A[j] < A[j-1]){
        tmp = A[j];
        A[j] = A[j-1];
        A[j-1] = tmp;
        count = count + 1;
      }

    }
  }
  trace(A,N,count);
}


int main(){
  int N,i,count;
  int A[100];

  scanf("%d", &N);
  for(i = 0; i<N; i++)scanf("%d",&A[i] );

  count = 0;
  bubblesort(A,N,count);
  //trace(A,N,count);

  return 0;
}



Measured memory_bytes: 2100
#include<bits/stdc++.h>
using namespace std;
//#pragma GCC target("popcnt")  //https://godbolt.org/z/yQv94Y 

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

#define INF 1e9
#define pi 3.141592653589
#define e 2.718281828459
#define phi 1.618033988749
#define MOD 1000000007
#define printarr(arr,n){for(int i=0;i<(n);i++){cout<<arr[i]<<" ";}cout<<endl;}
#define foreach(it , l) for(auto it = l.begin(); it != l.end(); ++it)
#define xlr8 ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define pll pair<ll,ll>
#define vpll vector<pair<ll,ll> >
#define rev_sort(a) sort(a.rbegin(),a.rend());

struct Timer
{
    chrono::time_point<chrono::high_resolution_clock> start , end;
    chrono:: duration<float> dur;
    Timer()
    {
        start = chrono::high_resolution_clock::now();
    }
    ~Timer()
    {
        end = chrono::high_resolution_clock::now();
        dur = end - start;
        cout<<"\nTime Elapsed : " <<dur.count() << " s\n";
    }
};

ll sum() {return 0;}
template<typename T, typename... Args>
T sum(T a , Args... args)   {return a + sum(args...); }

//76149
template<int D, typename T> 
struct Vec : public vector<Vec<D - 1, T>> {
  static_assert(D >= 1, "Vector dimension must be greater than zero!");
  template<typename... Args>
  Vec(int n = 0, Args... args) : vector<Vec<D - 1, T>>(n, Vec<D - 1, T>(args...)) {
  }
};
template<typename T>
struct Vec<1, T> : public vector<T> {
  Vec(int n = 0, T val = T()) : vector<T>(n, val) {
  }
};



int main()
{
    xlr8;
    int testCases  = 1;
    //cin>>testCases;
    while (testCases--)
    {
        string s;
        cin>>s;
        int n = s.length();

        for(int i = 0; i < n; i++)
            if(s[i] == '?')
                s[i] = 'D';
        cout<<s<<"\n";

    }
    
    

    

}


Measured memory_bytes: 3740
n,m = list(map(int, input().split()))
from collections import defaultdict
d=defaultdict(list)
for _ in range(m):
    a,b = list(map(int, input().split()))
    d[a].append(b)
    d[b].append(a)
ans=[0]*n
for k in d:
    ans[k-1]=len(d[k])
print(*ans, sep='\n')

Measured memory_bytes: 3316
#include<iostream>
#include<algorithm>
#define ios ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
int K,X;


int main()
{
	ios;
	cin>>K>>X;
	if((K*500)>=X) cout<<"Yes"<<"\n";
	else cout<<"No"<<"\n";
	return 0;
}

Measured memory_bytes: 3620
use v5.18; # strict say state
use warnings;
use List::Util qw(max);

chomp (my $n = <STDIN>);
chomp (my @a = split / /, <STDIN>);
my %h;
$h{$_}++ for @a;
my @s = sort {$b <=> $a} grep {$h{$_} >= 4} keys %h;
my @t = sort {$b <=> $a} grep {$h{$_} >= 2} keys %h;
my $ans = 0;
if (@s > 0) {
  $ans = $s[0] * $s[0];
}
if (@t > 1) {
  $ans = max($ans, $t[0] * $t[1]);
}
say $ans;

Measured memory_bytes: 28196
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int SIZE=3*100000;
typedef pair<int,int>P;
int N,a[SIZE],b[SIZE];

bool C(int x){
    priority_queue<int>que;
    int sum=0;
    for(int i=0;i<x-1;i++){
        que.push(a[i]);
        sum+=a[i];
    }

    for(int i=x-1;i<N;i++){
        que.push(a[i]);
        sum+=a[i];
        if(sum<=x*b[i])return true;
        sum-=que.top();
        que.pop();
    }
    return false;
}

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

    cin>>N;
    for(int i=0;i<N;i++)cin>>a[i]>>b[i];

    vector<P>st;
    for(int i=0;i<N;i++)st.push_back(P(b[i],a[i]));
    sort(st.rbegin(),st.rend());
    for(int i=0;i<N;i++){
        a[i]=st[i].second;
        b[i]=st[i].first;
    }


    int lb=0,ub=N+1;

    while(ub-lb>1){
        int mid=(lb+ub)/2;
        if(C(mid))lb=mid;
        else ub=mid;
    }

    cout<<lb<<endl;
    return 0;
}

Measured memory_bytes: 18020
#include<bits/stdc++.h>
#define N 1005
using namespace std;
typedef pair<int,int> P;

int main(){
  
  int n, l[N];
  char d[N];
  
  cin>>n;

  priority_queue<P,vector<P>,greater<P> > q;
  
  for(int i=0;i<n;i++){
    
    cin>>d[i]>>l[i];
    
    if(d[i]=='y') q.push(P(l[i],i));
    
  }
  
  vector<bool> used(n,0);
  
  int ans=0;
  
  while(!q.empty()){
    
    P t=q.top(); q.pop();
    
    int cost=t.first, node=t.second;
    
    if(used[node])continue;
    used[node]=1;
    
    ans++;
    
    for(int i=node-1;i>=0;i--){
      if(d[i]=='n'&&cost<=l[i])break;
      used[i]=1;
    }
    
    for(int i=node+1;i<n;i++){
      if(d[i]=='n'&&cost<=l[i])break;
      used[i]=1;
    }
    
  }

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

Measured memory_bytes: 3132
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

n,m = na()
if n <= 5:
    print(1900*n*2**n)
else:
    print((100*(n-m)+1900*m)*2**m)


Measured memory_bytes: 2940
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.OptionalInt;
import java.util.regex.Pattern;
import java.util.stream.Stream;

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

    new Main().run();
  }

  public void run() {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      String line = br.readLine();
      final Pattern delim = Pattern.compile("\\s");
      int[] arrayS = delim
        .splitAsStream(line)
        .mapToInt(Integer::parseInt)
        .toArray();

      OptionalInt max =
        Arrays.stream(arrayS).max();

      dispIntArray( countingSort(arrayS, max.getAsInt()) );
    }
    catch ( IOException e ) {
      System.out.println("IOException!");
    }

  }

  public int[] countingSort(int[] a, int k) {

    int   aLength = a.length;
    int[] result  = new int[aLength];
    int[] counter = new int[k+1];

    for (int var : a) {
      counter[var]++;
    }

    for (int i=1, max=k+1; i < max; i++) {
      counter[i] += counter[i-1];
    }

    for (int i=aLength-1, val=0; i>=0; i--) {
      val = a[i];
      result[counter[val]-1] = val;
      counter[val]--;
    }

    return result;
  }

  public void dispIntArray(int[] target) {
    StringBuilder s = new StringBuilder();

    for (int i : target) { s.append(i).append(" "); }
    s.setLength(s.length()-1);

    System.out.println(s);
  }
}


Measured memory_bytes: 180112
n,a,b,c,d = map(int,input().split())
mod = 10**9+7
rng = 1010
fctr = [1]
finv = [1]
for i in range(1,rng):
  fctr.append(fctr[-1]*i%mod)
for i in range(1,rng):
  finv.append(pow(fctr[i],mod-2,mod))
def cmb(n,k):
  if n<0 or k<0:
    return 0
  else:
    return fctr[n]*finv[n-k]*finv[k]%mod
wv = []
for i in range(a,b+1):
  wv.append([])
  for j in range(c,d+1):
    if i*j > n:
      continue
    v = fctr[i*j]*pow(finv[i],j,mod)*finv[j]%mod
    wv[-1].append((i*j,v))
  if wv[-1] == []:
    wv.pop()
x = len(wv)
dp = [[0 for i in range(n+1)] for j in range(x+1)]
dp[0][0] = 1
for i in range(1,x+1):
  dp[i][0] = 1
  for j in range(1,n+1):
    dp[i][j] = dp[i-1][j]
    for w,v in wv[i-1]:
      if j-w >= 0:
        dp[i][j] += dp[i-1][j-w]*v*cmb(n-(j-w),w)
      dp[i][j] %= mod
print(dp[x][n])

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

using namespace std;

#define ll long long
#define ld long double

int main()
{
	ll r,d,x;
	cin>>r>>d>>x;

	ll a[11];

	a[0] = x;

	for(ll i = 1 ; i <= 10; i++)
	{
		a[i] = r*a[i - 1] - d;
	}

	for(ll i = 1; i<= 10; i++)
	{
		cout<<a[i]<<endl;
	}

}	

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

int main()
{
  int N,Y;
  cin >> N >> Y;
  for(int n1 = 0;n1<=N;n1++) {
    if(Y<n1*10000) continue;
    for(int n2 = 0;n2<=N;n2++) {
      int n3 = N-n1-n2;
      if(n3>=0 && n3<=N && Y==(n1*10000+n2*5000+n3*1000)) {
        printf("%d %d %d\n",n1, n2, n3);
        return 0;
      }
    }
  }
  printf("%d %d %d\n",-1, -1, -1);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
 
	int n,q;
	long long int a,b;
	priority_queue <long long int> minpq;
	priority_queue <long long int,vector<long long int>,greater<long long int>> maxpq;
	long long int y = 0;
	long long int res = 0;
	int cnt = 1;
	long long int lsum = 0 , rsum = 0;
	cin >> n;
 
	for(int i=0;i<n;i++)
	{
		cin >> q;
		if(q==1)
		{
			cin >> a >> b;
			if(cnt==1)
			{
				lsum += a;
				minpq.push(a);
			}
			else
			{
				if(cnt==2)
				{
					if(minpq.top() > a)
					{
						long long int x = minpq.top();
						minpq.pop();
						lsum-=x;
						lsum+=a;
						minpq.push(a);
						rsum+=x;
						maxpq.push(x);
					}
					else
					{
						rsum+=a;
						maxpq.push(a);
					}
				}
				else
				{
					long long int x = minpq.top();
					long long int y = maxpq.top();
					//cout <<i << ' ' << x << ' ' << y << '\n';
					if(cnt % 2 == 0)
					{
						if(x<=a)
						{
							rsum+=a;
							maxpq.push(a);
						}
						else
						{
							minpq.pop();
							lsum-=x;
							lsum+=a;
							minpq.push(a);
							rsum+=x;
							maxpq.push(x);					
						}
					}
					else
					{
						if(a<=y)
						{
							lsum+=a;
							minpq.push(a);
						}
						else
						{
							maxpq.pop();
							rsum-=y;
							rsum+=a;
							maxpq.push(a);
							lsum+=y;
							minpq.push(y);	
						}
					}					
				}
			}
			y+=b;
			//cout << lsum << ' ' << rsum << ' ' << minpq.top() << ' ' << minpq.size() << ' ' << maxpq.size() << '\n';
			cnt++;
		}
		else
		{
			res = 0;
			long long int m = minpq.top();
			res = (minpq.size()*m - lsum) + (rsum - maxpq.size()*m);
			cout << minpq.top() << ' ' << res + y << '\n';
		}
	}
	return 0;
 
}

Measured memory_bytes: 3828
S = input()
res=0

def doubleCheck(moji):
  n = len(moji)//2
  if len(moji) % 2 ==1:
    return False
  else:
    if moji[0:n] == moji[n:len(moji)]:
      return True
    else:
      return False

for i in range(len(S)):
  S = S[0:len(S)-1]
  if doubleCheck(S):
    res = len(S)
    break
print(res)

Measured memory_bytes: 9084
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    int N; cin >> N;
    string S; cin >> S;
    int ans = 1;
    REP(i, N) {
        if (S.at(i) != S.at(i - 1))ans++;
    }
    cout << ans << endl;
}

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

int main() {
	int n, k, q;
	cin >> n >> k >> q;

	vector<int> p(n);
	for (int i = 0; i < n; i++) p.at(i) = k - q;

	int a;
	for (int i = 0; i < q; i++) {
		cin >> a;
		p.at(a - 1)++;
	}

	for (int i = 0; i < n; i++) {
		if (p.at(i) > 0) cout << "Yes" << endl;
		else cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n;
    cin >> n;
    int x[n];
    map<int, int> mp;
    rep(i, 0, n) {
        cin >> x[i];
        mp[i] = x[i];
    }
    sort(x, x + n);
    map<int, int> mp2;
    rep(i, 0, n) {
        mp2[x[i]] = i;
    }
    rep(i, 0, n) {
        if (mp2[mp[i]] <= n / 2 - 1) cout << x[n / 2] << endl;
        else cout << x[n / 2 - 1] << endl;
    }
    return 0;
}


Measured memory_bytes: 21376
n,q=input().split()
n=int(n)
q=int(q)
p_list=[]
timer=0
head=0
tail=n
for i in range(0,n):
    tmp=input()
    p_list.append([tmp.split()[0],int(tmp.split()[1])])
p_list.append("NULL")

def deque():
    global head
    tmp=p_list[head]
    head=(head+1)%(n+1)
    return tmp

def enque(x):
    global tail
    p_list[tail]=x
    tail=(tail+1)%(n+1)

while(head!=tail):
    elem=deque()
    timer+=min(elem[1],q)
    elem[1]-=min(elem[1],q)
    if elem[1]>0:
        enque(elem)
    else:
        print(str(elem[0])+" "+str(timer))




Measured memory_bytes: 13008
//A
#include <iostream>
using namespace std;
string S;
int i;
int j=0;
bool flag = false;
int main(){
  cin >> S;
  if(S.at(0) == 'A'){
    for (int i =0; i< S.length(); i++){
      if(2 <= i && i <=S.length()-2 && flag == false && S.at(i) == 'C'){
        flag = true;
        j=i;
        continue;
      }
      if(flag == true && S.at(i) == 'C'){
        cout << "WA" << endl;
        return 0;
      }
      if(i != 0 && 'A' <= S.at(i) &&  S.at(i) <='Z'){
        cout << "WA" << endl;
        return 0;
      }
      
    }
    if(flag == false){
      cout << "WA" << endl;
      return 0;
    }
    cout << "AC"  << endl;
  }else {
    cout << "WA" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
#define pii pair<ll,ll>
#define tii tuple<ll,ll,ll>
#define all(v) (v).begin(),(v).end()
#define ll long long
#define deb(x) cout << #x << "=" << x << endl;
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define ld long double
#define mod 1000000007
#define PI 3.141592653589793238
#define phi 1.638
#define eps 1e-9
#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;   

ll dp[3005][3005][4] = {0};

int main() {
    fastio
    ll r, c, k;
    cin>>r>>c>>k;
    map<ll, map<ll, ll>> mp;
    for(int i = 0; i<k; ++i) {
        ll vr, vc, vv;
        cin>>vr>>vc>>vv;
        mp[vr][vc] = vv;
    }

    memset(dp, 0, sizeof(dp));
    for(int i = 1; i<=r; ++i) {
        for(int j = 1; j<=c; ++j) {
            for(int l = 0; l<4; ++l) {
                dp[i][j][l] = max(dp[i][j][l], dp[i][j-1][l]);
                dp[i][j][0] = max(dp[i][j][0], dp[i-1][j][l]);
            }

            if(mp[i][j]>0) {
                for(int l = 0; l<4; ++l) {
                    dp[i][j][1] = max(dp[i][j][1], dp[i-1][j][l]+mp[i][j]);
                    if(l<3)
                        dp[i][j][l+1] = max(dp[i][j][l+1], dp[i][j-1][l]+mp[i][j]);
                }
            }
        }
    }

    cout<<max({dp[r][c][0], dp[r][c][1], dp[r][c][2], dp[r][c][3]})<<endl;
}

Measured memory_bytes: 848580
n,m = map(int,input().split())

if n == 1 and m == 1:
    print(1)
    exit(0)

if n == 1:
    print(m-2)
    exit(0)
if m == 1:
    print(n-2)
    exit(0)
print((n-2)*(m-2))


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define END getchar();getchar();return 0
#define inf 1000000007

signed main() {
	int n, ta = 0, ha = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		string t, h;
		cin >> t >> h;
		if (t == h) {
			ta++;
			ha++;
		}
		else if (t > h) {
			ta += 3;
		}
		else {
			ha += 3;
		}
	}
	cout << ta << " " << ha << endl;

	END; 
}



Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
const int maxn=250,mod=1e9+7,inf=0x3f3f3f3f;
int n,m,k,t;
struct FLOW
{
    int h[maxn],vis[maxn],cur[maxn],n,tot,s,t;
    const int inf=0x3f3f3f3f;
    void init(int n)
    {
        this->n=n;
        tot=0;
        memset(h,-1,sizeof(h[0])*n);
        memset(cur,0,sizeof(cur[0])*n);
    }
    struct node{int to,nxt,cap,flow;}e[maxn*10];
    void link(int x,int y,int z)
    {
        e[tot].to=y;
        e[tot].nxt=h[x];
        e[tot].cap=z;
        h[x]=tot++;
        e[tot].to=x;
        e[tot].nxt=h[y];
        h[y]=tot++;
    }
    bool bfs()
    {
        memset(vis,false,sizeof(vis[0])*n);
        queue<int>p;
        p.push(s);
        vis[s]=1;
        while(!p.empty())
        {
            int x=p.front();p.pop();
            for(int i=h[x];i!=-1;i=e[i].nxt)
            {
                int to=e[i].to,cap=e[i].cap,flow=e[i].flow;
                if(!vis[to]&&cap>flow)
                {
                    vis[to]=vis[x]+1;
                    p.push(to);
                }
            }
        }
        return vis[t];
    }
    int dfs(int x,int a)
    {
        if(x==t||a==0)return a;
        int ans=0,j;
        for(int&i=cur[x];i!=-1;i=e[i].nxt)
        {
            int to=e[i].to,cap=e[i].cap,flow=e[i].flow;
            if(vis[to]==vis[x]+1&&(j=dfs(to,min(a,cap-flow)))>0)
            {
                e[i].flow+=j;
                e[i^1].flow-=j;
                ans+=j;
                a-=j;
                if(a==0)break;
            }
        }
        return ans;
    }
    long long max_flow(int s,int t)
    {
        this->s=s,this->t=t;
        long long flow=0;
        while(bfs())
        {
            memcpy(cur,h,sizeof(h[0])*n);
            flow+=dfs(s,inf);
        }
        return flow;
    }
}mf;
int main()
{
    int i,j;
    //freopen("in.txt","r",stdin);
    scanf("%d",&n);
    mf.init(n+2);
    long long ret=0;
    for(i=1;i<=n;i++)
    {
        scanf("%d",&j);
        if(j>0)
        {
            ret+=j;
            mf.link(i,n+1,j);
        }
        else mf.link(0,i,-j);
        for(j=i+i;j<=n;j+=i)
            mf.link(i,j,inf);
    }
    printf("%lld\n",ret-mf.max_flow(0,n+1));
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;

int main(){
    int N,ans=0;cin>>N;
    int p[100010];
    for(int i=1;i<=N;i++){
        cin>>p[i];
    }
    int i=1;
    while(i<=N){
        if(p[i]==i){
            ans++;
            i+=2;
        }
        else i++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		//Input
		Scanner sc = new Scanner(System.in);
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		sc.close();

		//logic
		int answer = B;
		if(A <= 5){
			answer = 0;
		}else if (A > 5 && A <= 12) {
			answer /= 2;
		}

		//logic
		System.out.print(answer);

	}

}


Measured memory_bytes: 21844
#include"bits/stdc++.h"
using namespace std;
int N, C;
int a[200], b[200], d[200];
char s[200];
vector<int> c;

int ans = -1;
void solve(int n) {
	if (n < c.size()) {
		solve(n + 1);
		swap(a[c[n]], b[c[n]]);
		solve(n + 1);
		swap(a[c[n]], b[c[n]]);
	}
	else {
		int cost[100];
		cost[0] = 0;
		for (int i = 1; i < N; i++) cost[i] = 1e8;
		for (int i = 0; i < 10000; i++) {
			for (int j = 0; j < C; j++) {
				if (s[j] == '-') {
					if (cost[b[j]] > cost[a[j]] + d[j]) cost[b[j]] = cost[a[j]] + d[j];
				}
				else {
					if (cost[a[j]] > cost[b[j]] - d[j]) cost[a[j]] = cost[b[j]] - d[j];
				}
				if (cost[a[j]] > cost[b[j]] + 0) cost[a[j]] = cost[b[j]];
			}
		}
		for (int j = 0; j < C; j++) {
			if (s[j] == '-') {
				if (cost[b[j]] > cost[a[j]] + d[j]) return;
			}
			else {
				if (cost[a[j]] > cost[b[j]] - d[j]) return;
			}
		}
		for (int i = 0; i < N; i++)
			if (cost[i] < 0) return;
		for (int i = 0; i < N; i++) ans = max(ans, cost[i]);
	}
}

int main() {
	cin >> N >> C;
	for (int i = 0; i < C; i++) {
		string S;
		cin >> S;
		int j, k;
		for (j = 0; j < S.size()-1; j++) {
			if (S.substr(j, 2) == "<=") break;
			if (S.substr(j, 2) == ">=") break;
			if (S.substr(j, 1) == "*") break;
		}
		for (k = j + 1; k < S.size(); k++) {
			if (S.substr(k, 1) == "+") break;
			if (S.substr(k, 1) == "-") break;
		}
		a[i] = stoi(S.substr(0, j));
		if (S.substr(j, 1) == "*") {
			b[i] = stoi(S.substr(j + 1, k - (j + 1)));
			c.push_back(i);
		}
		else {
			b[i] = stoi(S.substr(j + 2, k - (j + 2)));
		}
		if (S.substr(j, 2) == ">=") swap(a[i], b[i]);
		a[i]--; b[i]--;
		d[i] = stoi(S.substr(k + 1, S.size() - (k + 1)));
		s[i] = S[k];
	}
	solve(0);
	if (ans == (int)1e8) cout << "inf" << endl;
	else cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3212
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var n int
    fmt.Scan(&n)
    ans := 2*n
    if n%2==0{
        ans-=n
    }
    fmt.Println(ans)
}





func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func scanTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func SortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}


Measured memory_bytes: 640
// 公式解答、時間計測のため
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int dp[5005][5005];

int main() {
  int n;
  string s;
  cin >> n >> s;
  for (int i = n-1; i >= 0; --i) {
    for (int j = n-1; j >= 0; --j) {
      if (s[i] != s[j]) dp[i][j] = 0;
      else dp[i][j] = dp[i+1][j+1]+1;
    }
  }
  int ans = 0;
  rep(i,n)rep(j,n) {
    if (i >= j) continue; // i < j;
    int now = min(dp[i][j], j-i);
    ans = max(ans, now);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 101388
# -*- coding: utf-8 -*-
"""
Illumination
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0569

"""
import sys


def solve(data, w, h):
    invisible_area = set()
    visible_area = set()
    visited = set()
    for y in range(h):
        for x in range(w):
            visited.add((x, y))
            if data[y][x] == 1:
                invisible_area.add((x, y))
            is_visible = False
            if (x, y) in invisible_area or (x, y) in visible_area:
                continue
            area = {(x, y)}
            stack = [(x, y)]
            while stack:
                cx, cy = stack.pop()
                visited.add((cx, cy))
                dxy = ((cx, cy-1), (cx+1, cy-1), (cx-1, cy), (cx+1, cy), (cx, cy+1), (cx+1, cy+1)) if cy % 2 == 0 else \
                      ((cx-1, cy-1), (cx, cy-1), (cx-1, cy), (cx+1, cy), (cx-1, cy+1), (cx, cy+1))
                for nx, ny in dxy:
                    if not (0 <= nx < w) or not (0 <= ny < h):
                        is_visible = True
                    if 0 <= nx < w and 0 <= ny < h and data[ny][nx] == 0 and (nx, ny) not in visited:
                        stack.append((nx, ny))
                        area.add((nx, ny))
            if is_visible:
                visible_area |= area
            else:
                invisible_area |= area

    ans = 0
    for cy in range(h):
        for cx in range(w):
            if data[cy][cx] == 1:
                dxy = ((cx, cy-1), (cx+1, cy-1), (cx-1, cy), (cx+1, cy), (cx, cy+1), (cx+1, cy+1)) if cy % 2 == 0 else \
                ((cx-1, cy-1), (cx, cy-1), (cx-1, cy), (cx+1, cy), (cx-1, cy+1), (cx, cy+1))
                ans += 6 - sum((nx, ny) in invisible_area for nx, ny in dxy)
    return ans



def main(args):
    w, h = map(int, input().split())
    data = [list(map(int, input().split())) for _ in range(h)]
    ans = solve(data, w, h)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])



Measured memory_bytes: 8444
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
#include <ctime>
#include <list>
#include <numeric>
#include <fstream>

using namespace std;
static const double EPS = 1e-8;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> PI;
#ifndef M_PI
const double M_PI=acos(-1.0);
#endif
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FORR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SZ(a) (int((a).size()))
#define F first
#define S second
void pkuassert(bool b){if(!b){int a=0;cout << 1/a << endl;}};
int dx[]={0,-1,0,1,1,1,-1,-1},dy[]={1,0,-1,0,1,-1,1,-1};

int h,w,n;

string in[100],tin[100];
bool err[100][100];

bool er(){
  memset(err,0,sizeof(err));
  bool ret=false;
  rep(i,h)rep(j,w){
    if(tin[i][j]=='.')continue;
    rep(k,2){
      int cx=i,cy=j;
      int cnt=0;
      while(true){
        if(min(cx,cy)<0 || cx>=h || cy>=w) break;
        if(tin[cx][cy]!=tin[i][j]) break;
        cx += dx[k];
        cy += dy[k];
        ++cnt;
      }
      if(cnt>=n)
        rep(l,cnt)
          ret=err[i+l*dx[k]][j+l*dy[k]]=1;
    }
  }

  rep(i,h)rep(j,w) if(err[i][j]) tin[i][j]='.';
  return ret;
}

void fal(){
  while(true){
    bool end=true;
    rep(i,h-1)rep(j,w){
      if(tin[i][j]!='.' && tin[i+1][j]=='.'){
        tin[i+1][j]=tin[i][j];
        tin[i][j]='.';
        end=false;
      }
    }
    if(end) break;
  }
}

bool ok(){
  rep(i,h) tin[i]=in[i];
  /*
  rep(i,h) cout << tin[i] << endl;
  cout << endl;*/
  fal();
  while(true){
    if(er()) fal();
    else break;
    //rep(i,h) cout << tin[i] << endl;cout << endl;
  }
  rep(i,h)rep(j,w)
    if(tin[i][j]!='.') return false;
  return true;
}
  

int main(){
  cin >>h >> w >> n;
  rep(i,h) cin >> in[i];

  rep(i,h)rep(j,w)rep(k,4){
    int nx=i,ny=j+dx[k];
    if(min(nx,ny)<0 || nx>=h || ny>=w) continue;
    //if(in[nx][ny]=='.' || in[i][j]=='.') continue;
    swap(in[nx][ny],in[i][j]);
    if(ok()){
      cout << "YES" << endl;
      return 0;
    }
    swap(in[nx][ny],in[i][j]);    
  }
  cout << "NO" << endl;
}
  

Measured memory_bytes: 1236
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vii;
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define PB push_back
#define F first
#define S second
#define nul -1
int main()
{
    double n;cin>>n;
    int res = ceil(n/1000.0);

    cout<<res*1000-n;
    return 0;
}


Measured memory_bytes: 3744
#pragma comment(linker, "/STACK:33554432")
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <unordered_map>
#include <iterator>
#include <stack>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <cstring>
#include <bitset>
#include <math.h>

using namespace std;

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

const int MAXN = 2e3 + 20;

void solve() {


    int h, a;

    int answr = 0 ;
    cin >> h >> a;

    while (h > 0){
        answr ++;
        h -= a;
    }

    cout << answr;


}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(20);

    solve();
}

Measured memory_bytes: 256
#include <iostream>

typedef long long ll;

int main(){
  ll N;
  std::cin >> N;
  ll temp = N % 1000;
  if(temp == 0){
    std::cout << 0 << std::endl;
    return 0;
  }
  std::cout << 1000 - temp << std::endl;
  return 0;
}


Measured memory_bytes: 3620
// practice with Dukkha
#include <algorithm>
#include <iostream>

using namespace std;

const int N = 100000, MD = 1000000007;

int aa[N], ff[N], gg[N];

int power(long long a, int k) {
	long long p = 1;
	while (k) {
		if (k & 1)
			p = p * a % MD;
		a = a * a % MD;
		k >>= 1;
	}
	return p;
}

long long ch(int n, int k) {
	return n < k ? 0 : (long long) ff[n] * gg[k] % MD * gg[n - k] % MD;
}

int main() {
	int n, k; cin >> n >> k;
	for (int f = 1, i = 0; i < n; i++) {
		gg[i] = power(ff[i] = f, MD - 2);
		f = (long long) f * (i + 1) % MD;
	}
	for (int i = 0; i < n; i++)
		cin >> aa[i];
	sort(aa, aa + n);
	long long ans = 0;
	for (int i = 0; i < n; i++)
		ans = (ans + (aa[i] - aa[n - 1 - i]) * ch(i, k - 1)) % MD;
	if (ans < 0)
		ans += MD;
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 4712