akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using str = string;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
const double PI = 3.141592653589793238;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = m; i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greator<>()
#define d20 std::setprecision(20)
#define veci vector<int>
#define vecll vector<long long int>

template <typename T>
T lcm(T a, T b)
{
	return a / __gcd(a, b) * b;
}
void comb(vector<vector<ll>> &v) //v{n][k] == nCk
{
	for (int i = 0; i < v.size(); i++)
	{
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int k = 1; k < v.size(); k++)
	{
		for (int j = 1; j < k; j++)
		{
			v[k][j] = v[k - 1][j - 1] + v[k - 1][j];
		}
	}
}
string RunLengthEncoding(string str)
{
	int itr = 0;
	std::string res;
	while (itr < int(str.size()))
	{
		char tmp = str[itr++];
		int length = 1;
		while (itr < int(str.size()) && str[itr] == tmp)
		{
			++itr;
			++length;
		}
		res.push_back(tmp);
		res += to_string(length);
	}
	return res;
}
int main()
{
	int a, b;
	cin >> a >> b;
	if(a/10>0 || b/10>0){
		cout << -1 << endl;
	}
	else{
		cout << a * b << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long                  // Short form for long long
#define ld long double                // Short form for long double
typedef pair<ll, ll> pii;              // Pair of long long
typedef vector<ll> vi;                // Vector of long long
typedef vector<vi> vvi;               // Vector of vector of long long
typedef vector<pii> vii;               // Vector of pairs
typedef vector<vii> vvii;             // Vector of vector of pairs
#define pq priority_queue             // Max heap (To convert to min heap, use negative sign before every value)
#define ff first                      // For pairs
#define ss second                     // For pairs
#define pb push_back                  // Pushback to vector
#define mp make_pair                  // Makes pairs to be stored as pair
#define all(c) (c).begin(), (c).end() // Mainle used for sorting and reversing 
ll mod = 1e9 + 7;
ll t=1;
string s;
vvi adj;
ll n,m,x,y;
vi dp,vis;

void dfs(int i){
    // if(vis[i])return;
    vis[i]=1;
    ll dist=0;
    for(auto u:adj[i]){
        if(vis[u]){dist = max(dist,dp[u]+1);  continue;}
        dfs(u);
        dist = max(dist,dp[u]+1);
    }
    dp[i] = dist;
}


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // cin>>t;
    while(t--){
        cin>>n>>m;
        dp.resize(n+1);
        adj.resize(n+1);
        vis.resize(n+1,0);
        
        for(int i=0;i<m;i++){cin>>x>>y;adj[x].pb(y);}
        ll ans=0;
        for(int i=1;i<=n;i++){            
            if(!vis[i])dfs(i);
            ans = max(ans,dp[i]);
        }
        cout<<ans<<"\n";
        // for(auto u:dp)cout<<u<<" ";

    }
    return 0;
}    

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

public class Main
{
    public static void main(String[] args)
    {
        Deque<String> formula = new ArrayDeque<String>();
        Scanner scan = new Scanner(System.in);

        while(scan.hasNext())
        {
            String input = scan.next();
            int num2,num1;

            if(input.equals("+"))
            {
                num2 = Integer.parseInt(formula.poll());
                num1 = Integer.parseInt(formula.poll());
                formula.push(String.valueOf(num1+num2));
            }
            else if(input.equals("*"))
            {
                num2 = Integer.parseInt(formula.poll());
                num1 = Integer.parseInt(formula.poll());
                formula.push(String.valueOf(num1*num2));
            }
            else if(input.equals("-"))
            {
                num2 = Integer.parseInt(formula.poll());
                num1 = Integer.parseInt(formula.poll());
                formula.push(String.valueOf(num1-num2));                
            }
            else if(input.equals("="))
            {
                break;
            }
            else
            {
                formula.push(input);
            }
            int size = formula.size();
            for(int i = 0; i<size; i++)
            {
                String p = formula.pollLast();
//                System.out.printf("%s ",p);
                formula.push(p);
            }
//            System.out.println();
        }
        System.out.println(formula.poll());
    }
}

Measured memory_bytes: 26832
#include<iostream>
using namespace std;
int N,M,a,b;
int main(){
    cin>>N>>M;
    int cnt[N];
    for(int i=0;i<N;i++)cnt[i]=0;
    for(int i=0;i<M;i++){
        cin>>a>>b;
        cnt[a-1]++,cnt[b-1]++;
    }
    for(int i=0;i<N;i++)if(cnt[i]%2){cout<<"NO"<<endl;return 0;}
    cout<<"YES"<<endl;
    return 0;
}

Measured memory_bytes: 640
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <climits>
#include <set>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}


int main() {

    int H, W;
    cin >> H >> W;

    vector <string> a(H);
    for (int i = 0; i < H; i++)cin >> a[i];

    vector <vector<bool>> flags(H, vector<bool>(W, false));

    for (int i = 0; i < H; i++) {
        bool flag = true;
        for (int j = 0; j < W; j++) if (a[i][j] == '#')flag = false;
        if (flag) for (int j = 0; j < W; j++) flags[i][j] = true;
    }
    for (int i = 0; i < W; i++) {
        bool flag = true;
        for (int j = 0; j < H; j++) if (a[j][i] == '#') flag = false;
        if (flag)for (int j = 0; j < H; j++) flags[j][i] = true;
    }
//
//    for (int i = 0; i < H; i++) SHOW_VECTOR(flags[i]);

    vector <string> ans;
    for (int i = 0; i < H; i++) {
        string str = "";
        for (int j = 0; j < W; j++) if (!flags[i][j]) str += a[i][j];
        if (str.size()) ans.push_back(str);
    }

    for (auto x: ans)cout << x << endl;

}















































Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

signed main()
{
    int n, m;
    cin >> n >> m;
    vector<pair<int,int>> h(n);
    REP(i,n) {
        cin >> h[i].first;
        h[i].second = i;
    }
    vector<vector<int>> G(n, vector<int>());
    for (int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    int cnt = 0;
    for (int i = 0; i < n; i++)
    {
        int x = h[i].first;
        bool ok=true;
        for (auto &u : G[i])
        {
            if(h[u].first >= x){
                ok = false;
                break;
            }
        }
        if(ok){
         //   cerr << i << endl;
            cnt++;
        }
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 10588
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<LL> VI;
typedef vector<VI> VVI;
typedef pair<LL, LL> PII;
typedef vector<string> VS;
inline LL toInt(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(x,c) for(auto x: (c))
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define ALL(c) (c).begin(), (c).end()
#define REVERSE(c) reverse(ALL(c))
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define STABLE_SORT(c) stable_sort(ALL(c))
#define STABLE_RSORT(c) stable_sort((c).rbegin(),(c).rend())
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)), (c).end());
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
const double INF = 1e7;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define dump(x)  cerr << #x << " = " << (x) << endl;


int main() {
    VI X(3);
    LL ans = -1;
    REP(i, 3) {
        cin >> X[i];
        if (X[i] % 2 == 0) ans = 0;
    }
    if (ans < 0) {
        SORT(X);
        ans = X[0] * X[1];
    }

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


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

using namespace std;

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

    int start = max(a, c);
    int end = min(b, d);

    int duration = end - start;
    cout << (duration < 0 ? 0 : duration) << endl;    

    return 0;
}

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

int main() {
    int N;
    cin >>N;
    vector<int> a(N);
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
    }
    
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        if (i % 2 != 0)
        {
            continue;
        }
        if (a[i] % 2 == 1)
        {
            ans++;
        }
        
    }
    cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3624
#include<stdio.h>
int main(void){
    int N,K;
    scanf("%d %d", &N, &K);
    char S[N];
    scanf("%s", S);
    K = K -1;
    if(S[K] == 'A') S[K] = 'a';
    else if(S[K] == 'B') S[K] = 'b';
    else S[K] = 'c';

    printf("%s\n", S);

    return 0;
}

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

int main() {
  int A, B, C, D;
  
  cin >> A >> B >> C >> D;
  
  if ((D < A) || (B < C)) cout << "0" << endl;
  else if ((A <= C) && (B <= D)) cout << B-C << endl;
  else if ((A > C) && (B <= D)) cout << B-A << endl;
  else if ((A <= C) && (B > D)) cout << D-C << endl;
  else if ((A > C) && (B > D)) cout << D-A << endl;
  
}

Measured memory_bytes: 256
def search(N, i, result, state=""):
    if i == 3:
        if result == 7:
            return state + N[3]
        else:
            return ""
    ret = search(N, i+1, result + int(N[i+1]), state + N[i] + "+")
    if ret:
        return ret
    else:
        return search(N, i+1, result - int(N[i+1]), state + N[i] + "-")


def main():
    N = input()
    print(search(N, 0, int(N[0])) + "=7")


if __name__ == "__main__":
    main()


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

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if (a+b>c+d){
    cout << "Left" << endl;
  }else if (a+b==c+d){
    cout << "Balanced" << endl;
  }else{
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
a,b,m=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
lst=[]
for i in range(m):
  x,y,c=map(int,input().split())
  lst.append([x,y,c])
v=min(A)+min(B)
for i in range(m):
  V=A[lst[i][0]-1]+B[lst[i][1]-1]-lst[i][2]
  if v>V:
    v=V
print(v)
  
  


Measured memory_bytes: 80748
#include <bits/stdc++.h>
using namespace std;
 
/*** Template Begins ***/
 
typedef long long   ll;
typedef pair<ll,ll> pll;
typedef long double ld; 
#define rep(i,a,b) for(i=a;i<b;i++)
#define pb           push_back
#define F            first
#define S            second
#define ios          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define hell   1000000007LL
#define all(a)       (a).begin(),(a).end()
ll power(ll x, ll y, ll p){ ll res = 1;x = x % p;while (y > 0) {if (y & 1) res = (res*x) % p;y = y>>1;
  x = (x*x) % p;} return res;} 

const long double PI = acos(-1);
// Debug //
#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
ll euclid(ll x,ll y,ll a,ll b){
  return (a-x)*(a-x)+(b-y)*(b-y);
}
void solve()
{
  string s,t;
  ll ans=0;
  cin>>s>>t;
  ll i,n=s.length();
  for(i=0;i<n;i++)
  {
    if(s[i]!=t[i])
      ans++;
  }
  cout<<ans;  
}

int main()
{ 
  ios; 
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
  ll t=1,i=1;
  // cin>>t;
  while(i<=t)
  {
    solve();
    i++;
  }
  return 0;
}


Measured memory_bytes: 3796
import java.util.Scanner;

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

		int max = 1;
		for (int b = 1; b < i + 1; b++) {
			for (int p = 2; p <11 ; p++) {
				if ((Math.pow(b, p) <= i)) {
					if (max < Math.pow(b, p)) {
						max = (int) Math.pow(b, p);
					}
				}
			}
		}
		System.out.println(max);
	}
}


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

#define cn count;
#define pb push_back
#define in insert
#define fs first
#define sc second
#define sz size
#define len length
#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define forni(i, n) for (ll i = 1; i < (ll) (n); ++i)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;
using ll = long long;
const ll inf = 1e9+7; 
const double PI =  3.141592653589793;

int main(){
	ll n,x,l,cnt=0,ans=1;
	bool f = true;
	cin>>n>>x;
	while(n--){
		cin>>l;
		cnt+=l;
		if(x<cnt) f=false;
		if(f) ans++;
	}
	cout<<ans<<"\n";
	return 0;
}

// _   .-')                .-. .-')                 .-')                                               
//( '.( OO )_              \  ( OO )               ( OO ).                                             
// ,--.   ,--.).-'),-----. ,--. ,--.  .-'),-----. (_)---\_) ,--. ,--.     .-----.  ,-.-')  .-'),-----. 
// |   `.'   |( OO'  .-.  '|  .'   / ( OO'  .-.  '/    _ |  |  | |  |    '  .--./  |  |OO)( OO'  .-.  '
// |         |/   |  | |  ||      /, /   |  | |  |\  :` `.  |  | | .-')  |  |('-.  |  |  \/   |  | |  |
// |  |'.'|  |\_) |  |\|  ||     ' _)\_) |  |\|  | '..`''.) |  |_|( OO )/_) |OO  ) |  |(_/\_) |  |\|  |
// |  |   |  |  \ |  | |  ||  .   \    \ |  | |  |.-._)   \ |  | | `-' /||  |`-'| ,|  |_.'  \ |  | |  |
// |  |   |  |   `'  '-'  '|  |\   \    `'  '-'  '\       /('  '-'(_.-'(_'  '--'\(_|  |      `'  '-'  '
// """    """     """""""" """  """"      """""""  """""""  """"""""      """"""   """         """""""


Measured memory_bytes: 3620
#include <stdio.h>
long long f(long long y,long long x)
{
    if(y==-1)
    {
        return 0;
    }
    else
    {
        return y/x+1;
    }
}
int main()
{
    long long a,b,x;
    scanf("%lld %lld %lld",&a,&b,&x);
    a--;
    printf("%lld",f(b,x)-f(a,x));
    return 0;
}


Measured memory_bytes: 128
import unittest


class TestD(unittest.TestCase):
    def test_1(self):
        self.assertEqual(think(3, [1, 2, 2, 4, 5]), 7.0)

    def test_2(self):
        self.assertEqual(think(1, [6, 6, 6, 6]), 3.5)

    def test_3(self):
        self.assertEqual(think(4, [17, 13, 13, 12, 15, 20, 10, 13, 17, 11]), 32.0)


def solve():
    k, p = read()
    result = think(k, p)
    write(result)


def read():
    n, k = read_int(2)
    return k, read_int(n)


def read_int(n):
    return read_type(int, n, sep=' ')


def read_float(n):
    return read_type(float, n, sep=' ')


def read_type(t, n, sep):
    return list(map(lambda x: t(x), read_line().split(sep)))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(k, p):
    prob = [0 for _ in range(len(p))]
    for i, elem in enumerate(p):
        prob[i] = (elem * (elem + 1)) / (2 * elem)
    prob = [0.0] + prob
    accumulated = [0.0 for _ in range(len(prob))]
    for i in range(len(prob)):
        if i == 0:
            continue
        accumulated[i] = accumulated[i - 1] + prob[i]

    maximum_expectation = -1
    for i in range(len(accumulated)):
        if i + k >= len(accumulated):
            break
        maximum_expectation = max(maximum_expectation, accumulated[i + k] - accumulated[i])
    return maximum_expectation


def write(result):
    print(result)


if __name__ == '__main__':
    # unittest.main()
    solve()


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

#define int 		long long
#define vi 			vector <int>
#define si 			set <int>
#define pii 		pair<int,int>
#define fr(n) 		for(__typeof(n) i=0;i<n;i++)
#define rep(i,a,b) 	for(__typeof(b) i=a;i<b;i++)
#define repi(i,b,a) for(__typeof(a) i=b;i>=a;i--)
#define tr(a) 		for(auto it=a.begin();it!=a.end();it++)
#define pb 			push_back
#define mp 			make_pair
#define F 			first
#define S 			second
#define FAST 		ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define time_passed	1.0 * clock() / CLOCKS_PER_SEC

void solve()
{
	int n;
	cin>>n;
	if(n>=30)
		cout<<"Yes";
	else
		cout<<"No";
}

signed main()
{
	FAST
	int test=1;
	//cin>>test;
	while(test--)
	{
		solve();
	}
	cerr<<endl<<"Time elapsed : "<<time_passed<<endl;
	return 0;
}

Measured memory_bytes: 3796
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = False

n = INT()
a = LIST()
x = [0 for _ in range(n)]
x[0] = sum(a) - 2 * sum([a[i] for i in range(1, n, 2)])
for i in range(1, n):
    x[i] = 2 * (a[i - 1] - x[i - 1] // 2)
debug(x)
x = [str(i) for i in x]
print(' '.join(x))

Measured memory_bytes: 93716
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


using namespace std;
using namespace __gnu_pbds;

typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<pair<int,int>, null_type,less<pair<int, int> >,rb_tree_tag,tree_order_statistics_node_update > pbds;

#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#define ROUNDOFFINT(d) d = (int)((double)d + 0.5)

#define pb push_back
#define ft first
#define sd second
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

ll power(ll a, ll b) {
    ll res = 1;
    while(b) {
        if(b % 2) {
            res *= a;
        }
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll power(ll a, ll b, ll mod) {
    ll res = 1;
    a %= mod;
    while(b) {
        if(b % 2) {
            res *= a;
            res %= mod;
        }
        a = a * a % mod;
        b >>= 1;
    }
    return res % mod;
}
const int N = 5e6 + 5;
int n, k, p;

bool ispalin(string &s) {
    int b = true;
    int i=0, j=s.length()-1;
    for(; i<j; i++, j--) {
        if(s[i] != s[j]) return false;
    }
    return true;
}
signed main() {
    int t;
    // cin >> t;
    t = 1;
    for(int _=1; _<=t; _++) {
        string s;
        cin >> s;
        if(ispalin(s)) {
            int len = (s.length()-1)/2;
            string str = s.substr(0, len);
            if(ispalin(str)) {
                int l = (s.length()+3)/2;
                l--;
                string ss = s.substr(l);
                if(ispalin(ss)) {
                    cout << "Yes\n";
                }
                else cout << "No\n";
            }
            else {
                cout << "No\n";
            }
        }
        else {
            cout << "No\n";
        }
    }
    return 0;
}


Measured memory_bytes: 256
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

N = getN()
A = getList()
B = getList()
cnt = 0
for i in range(N):
    minus1 = min(A[-i - 1], B[-i - 1])
    A[-i - 1] -= minus1
    B[-i - 1] -= minus1
    cnt += minus1
    minus2 = min(A[-i - 2], B[-i - 1])
    A[-i - 2] -= minus2
    B[-i - 1] -= minus2
    cnt += minus2
print(cnt)

Measured memory_bytes: 80996
D = int(input())
C = list(map(int, input().split()))
#  S = [[1st day], [2nd day],  ..., [D-th day]]
S = []
for i in range(D):
    Si = list(map(int, input().split()))
    S.append(Si)
I = 26

last = [0]*I

score = S[1]
contest = score.index(max(score))

last = [x+1 for x in last]
last[contest] = 0

print(contest + 1)

for day in range(1, D):
    score = [last[i]*C[i]*S[day][i] for i in range(I)]
    contest = score.index(max(score))

    last = [x+1 for x in last]
    last[contest] = 0

    print(contest + 1)

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

using namespace std;

int main()
{
  int N, K;
  int p[200000];
  int ans = 0;
  int tmp = 0;
  
  scanf("%d %d", &N, &K);
  for (int i = 0; i < N; i++) {
    scanf("%d", p + i);
    p[i]++;
    tmp += p[i];
    if (i >= K) tmp -= p[i - K];
    ans = max(ans, tmp);
  }
  
  printf("%d%s\n", ans / 2, (ans % 2 ? ".5" : ""));
  
  return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)
#define INF 1000000000

int dp[100001];
int main() {
	int N;
	int p[100001];
	cin >> N;
	REP(i, 0, N) cin >> p[i];
	
	REP(i, 0, N) dp[i] = INF;
	dp[0] = 0;

	queue<int> q;
	q.push(0);
	while (!q.empty()) {
		int now = q.front();
		if (now == N-1) break;
		q.pop();

		REP(i, 1, 7) {
			int next = now + i;
			if (next >= N) next = N - 1;

			if (dp[next] != INF) continue;
			
			bool flag = false;
			while (p[next] != 0) {
				next += p[next];
				if (next >= N) {
					next = N - 1;
					break;
				}
				else if(dp[next]!=INF){
					flag = true;
					break;
				}
				dp[next] = dp[now] + 1;
			}
			if (flag) continue;
			dp[next] = dp[now] + 1;
			q.push(next);
		}
	}

	cout << dp[N - 1] << endl;
	return 0;
}

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

int main(void){
	int n;
	cin >> n;
	typedef struct{
		int y;
		int m;
		int d;
	}ymd;
	vector<ymd> birth(n);
	for(int i=0; i<n; i++){
		cin >> birth[i].y >> birth[i].m >> birth[i].d;
	}

	for(int i=0; i<n; i++){
		int day=0;
		int y = birth[i].y;
		int m = birth[i].m;
		int d = birth[i].d;
		if(y%3==0 || m%2==1){
			day = 20-d+1;
		}else{
			day = 19-d+1;
		}
		m++;
		if(m>10){
			m=1;
			y++;
		}
		for(int j=y; j<1000; j++){
			for(int k=m; k<=10; k++){
				if(j%3==0 || k%2==1){
					day += 20;
				}
				else{
					day += 19;
				}
			}
			m=1;
		}
		cout << day << endl;
	}
	return 0;
}

Measured memory_bytes: 3084
#include<bits/stdc++.h>
typedef long long ll;
#define INF 100000000
#define MOD 1000000007
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
using namespace std;
bool solve(int n){
    int ans=0;
    while(n){
        ans++;
        n/=10;
    }
    return ans%2;
}
int main(void){
    int n;
    cin>>n;
    int ans=0;
    for(int i=1;i<=n;i++){
        if(solve(i)){
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

int main()
{
  int w, h, n;
  cin >> w >> h >> n;
  int a[3][n];
  for (int i = 0; i < n; i++)
  {
    cin >> a[0][i] >> a[1][i] >> a[2][i];
  }
  
  int max_x = w;
  int max_y = h;
  int min_x = 0;
  int min_y = 0;
  for (int i = 0; i < n; i++)
  {
    if (a[2][i] == 1)
    {
      if (min_x < a[0][i])
      {
        min_x = a[0][i];
      }
    }
    if (a[2][i] == 2)
    {
      if (max_x > a[0][i])
      {
        max_x = a[0][i];
      }
    }
    if (a[2][i] == 3)
    {
      if (min_y < a[1][i])
      {
        min_y = a[1][i];
      }
    }
    if (a[2][i] == 4)
    {
      if (max_y > a[1][i])
      {
        max_y = a[1][i];
      }
    }
  }
  
  if (max_x <= min_x || max_y <= min_y)
  {
    cout << 0 << endl;
  }
  else
  {
    cout << (max_x - min_x) * (max_y - min_y) << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>

#define lint long long int
#define N_MAX 200001
#define DIV 1000000007


int main()
{
    int n, k;
    scanf("%d %d", &n, &k);
    
    lint cum_sum[N_MAX]; cum_sum[0] = 0;
    for (int i = 1; i <= n; i++) cum_sum[i] = cum_sum[i-1] + i;
    
    lint ans = 0;
    for (int i = k; i < n+1; i++) {
        lint sum = (cum_sum[n]-cum_sum[n-i]) - cum_sum[i-1] + 1;
        ans += sum;
        ans %= DIV;
    }
    
    //i == n+1 の場合は1通りのみ
    ans++;
    ans %= DIV;
    
    printf("%lld\n", ans);
}


Measured memory_bytes: 3296
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ARC067D - Walk and Teleport
  // 難しく考えなくて良い
  ll N, A, B; cin >> N >> A >> B;
  vector<ll> X(N);
  REP(i, N){
    cin >> X[i];
  }
  ll ans = 0;
  REP(i, N-1){
    ans += min((X[i+1] - X[i]) * A, B);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <set>

using namespace std;

int main() {
  int s; cin >> s;
  int i = 1;

  set<int> found;
  i = 2;
  found.insert(s);
  
  while (1) {
    int nt = s % 2 == 0 ? s / 2 : (3 * s + 1);
    if (found.count(nt) > 0) {
    	cout << i << endl;
      break;
    }
    found.insert(nt);
    s = nt;
    i++;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;

int main(){
    ll x;
    cin >> x;
    ll now = 100;
    int cnt = 0;
    while(now < x){
        now *= 1.01;
        ++cnt;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3632
import Data.List

cap = [4, 1, 4, 1, 2, 1, 2, 1]

rot :: [Int] -> Int -> [Int]
rot v n =
  let f = take n v
      r = drop n v
  in
    r ++ f

cal [] [] = 0
cal (c:cs) (v:vs) =
  let n = if c < v
          then 0
          else c - v
  in
    n + (cal cs vs)

to_i' (v:[]) = v
to_i' (v:vs) = (to_i' vs) * 10 + v

to_i v = to_i' $ reverse v

ans v =
  let r = zip [0..7] $ map (cal v) $ map (rot cap) [0..7]
      (i,_) = minimumBy (\ (n0,v0) (n1,v1) -> let c0 = compare v0 v1
                                                  i0 = to_i $ rot cap n0
                                                  i1 = to_i $ rot cap n1
                                                  c1 = compare i0 i1
                                              in
                                                if c0 /= EQ
                                                then c0
                                                else c1 ) r
  in
    rot cap i

main = do
  c <- getContents
  let i = map (map read) $ map words $ lines c :: [[Int]]
      o = map ans i
  mapM_ putStrLn $ map unwords $ map (map show) o

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

#define debug(x) cout << #x << " = " << x << endl
#define fori(i, ini, lim) for(int i = int(ini); i < int(lim); i++)
#define ford(i, ini, lim) for(int i = int(ini); i >= int(lim); i--)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;

const int MOD = 1e9 + 7;
const int MAX = 24000000 + 5;
int digits[MAX];

inline int add(int a, int b) {
	a += b;
	if(a >= MOD) {
		a -= MOD;
	}
	return a;
}

inline int mult(int a, int b) {
	return (1LL * a * b) % MOD;
}

inline int sub(int a, int b) {
	a -= b;
	if(0 > a) {
		a += MOD;
	}
	return a;
}

int f_exp(int x, int exp) {
	if(exp == 0) {
		return 1;
	}
	else if(exp & 1) {
		return mult(x, f_exp(x, exp - 1));
	}
	return f_exp(mult(x, x), exp / 2);
}

int main() {
	ios_base::sync_with_stdio(false);

	int s;
	cin >> s;

	int ans = 0;
	int left = 1, d = 1, p = 1, sum = 0;
	fori(right, 1, 23000000 + 1) {
		if(p * 10 == right) {
			d++;
			p *= 10;
		}

		digits[right] = d;
		sum += digits[right];

		while(sum > s) {
			sum -= digits[left++];
		}

		if(digits[left] > 7) {
			break;
		}

		ans = add(ans, sum == s);
	}

	fori(i, 1, s / 8 + 1) {
		if(s % i == 0) {
			int q = s / i;
			int range_len = sub(f_exp(10, q), f_exp(10, q - 1));
			ans = add(ans, add(sub(range_len, i), 1));
		}
		else {
			ans = add(ans, 1);
		}
	}

	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 90368
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

const int MAX_N = 200001;

int par[MAX_N];
int Rank[MAX_N];
int size;

void init(int n) {
    for (int i = 0; i < n; i++) {
        par[i] = i;
        Rank[i] = 0;
    }
    size = n;
}


int find(int x) {
    if (par[x] == x) {
        return x;
    } else {
        return par[x] = find(par[x]);
    }
}

void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;

    size--;
    if (Rank[x] < Rank[y]) {
        par[x] = y;
    } else {
        par[y] = x;
        if (Rank[x] == Rank[y]) {
            Rank[x]++;
        }
    }
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K, L;
    cin >> N >> K >> L;
    int p[K], q[K];

    init(N);
    int E1[N] = {};
    rep(i, K) {
        cin >> p[i] >> q[i];
        p[i]--; q[i]--;
        unite(p[i], q[i]);
    }
    rep(i, N) E1[i] = find(i);
    //rep(i, N) cout << "E1[" << i << "] = " << E1[i] << endl;
    int r[L], s[K];
    init(N);
    int E2[N] = {};
    rep(i, L) {
        cin >> r[i] >> s[i];
        r[i]--; s[i]--;
        unite(r[i], s[i]);
    }
    rep(i, N) E2[i] = find(i);
    //rep(i, N) cout << "E2[" << i << "] = " << E2[i] << endl;
    map<pair<int,int>, int> ma;
    rep(i, N) ma[make_pair(E1[i], E2[i])]++;
    rep(i, N-1) cout << ma[make_pair(E1[i], E2[i])] << " ";
    cout << ma[make_pair(E1[N-1], E2[N-1])] << endl;

    return 0;
}


Measured memory_bytes: 16512
// Author: Shusuke Ueda
// AtCoder Beginner Contest 134 - Problem B

#include <iostream>

int main() {
    int n, d;
    std::cin >> n >> d;

    int w = 2 * d + 1;
    std::cout << (n + w - 1) / w << std::endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main {
	static class pair implements Comparable<pair>{
		long x,h;
		pair(long xx,long hh){x=xx;h=hh;}
		@Override
		public int compareTo(pair o) {
			return Long.compare(x,o.x);
		}
		
	}
	public static void main(String[] args) throws Exception {
		MScanner sc=new MScanner(System.in);
		PrintWriter pw=new PrintWriter(System.out);
		int n=sc.nextInt(),d=sc.nextInt(),a=sc.nextInt();
		pair[]in=new pair[n];
		for(int i=0;i<n;i++) {
			in[i]=new pair(sc.nextLong(), sc.nextLong());
		}
		Arrays.sort(in);
		int i=0;
		PriorityQueue<Long>pq=new PriorityQueue<Long>();
		TreeSet<Long>xs=new TreeSet<Long>();
		HashMap<Long, Long>map=new HashMap<Long, Long>();
		
		long range=in[0].x+2l*d;
		long tot=0;
		long ans=0;
		while(i<n) {
			long damage=0;
			long nxtrange=-1;
			while(i<n && in[i].x<=range) {
				xs.add(in[i].x);
				pq.add(in[i].h+tot);
				map.put(in[i].x, in[i].h+tot);
				i++;
			}
			if(i!=n) {
				nxtrange=in[i].x-2l*d;
			}
			while(!xs.isEmpty() && (nxtrange==-1 || xs.first()<nxtrange)) {
				damage=Math.max(damage, (map.get(xs.first())-tot+a-1)/a);
				xs.pollFirst();
			}
			ans+=damage;
			tot+=damage*a;
			while(!pq.isEmpty() && pq.peek()<=tot) {
				pq.poll();
			}
			range=nxtrange+2l*d;
		}
		pw.println(ans);
		pw.flush();
	}
	static class MScanner {
		StringTokenizer st;
		BufferedReader br;
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int[] takearr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public long[] takearrl(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public Integer[] takearrobj(int n) throws IOException {
	        Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public Long[] takearrlobj(int n) throws IOException {
	        Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}


Measured memory_bytes: 105012
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

int main(){
    int v,e;
    cin >> v >> e;
    vector<vector<ll>> dist(v,vector<ll>(v,LINF));
    rep(i,v) dist[i][i] = 0;
    rep(i,e){
        ll s,t,d;
        cin >> s >> t >> d;
        dist[s][t] = d;
    }

    rep(k,v)rep(i,v)rep(j,v){
        if(dist[i][k]!=LINF&&dist[k][j]!=LINF) dist[i][j] = min(dist[i][j],dist[i][k]+dist[k][j]);
    }

    rep(i,v){
        if(dist[i][i]<0){
            cout << "NEGATIVE CYCLE" << endl;
            return 0;
        }
    }

    rep(i,v)rep(j,v){
        if(dist[i][j]>=LINF) cout << "INF" <<  (j==v-1?'\n':' ');
        else cout << dist[i][j] <<  (j==v-1?'\n':' ');
    }

    return 0;
}


Measured memory_bytes: 3248
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	N, K := getStdinInt2()
	h := getStdinIntArr()

	ans := 0
	for i := 0; i < N; i++ {
		if h[i] >= K {
			ans++
		}
	}

	fmt.Printf("%d\n", ans)
}

var sc = bufio.NewReaderSize(os.Stdin, 1024*1024*10)

func getStdin() string {
	return readLine()
}
func getStdinInt() int {
	str := getStdin()
	rtn, _ := strconv.Atoi(str)
	return rtn
}
func getStdinInt2() (int, int) {
	list := getStdinIntArr()
	return list[0], list[1]
}
func getStdinInt3() (int, int, int) {
	list := getStdinIntArr()
	return list[0], list[1], list[2]
}
func getStdinInt64() int64 {
	str := getStdin()
	rtn, _ := strconv.ParseInt(str, 10, 64)
	return rtn
}
func getStdinIntU64() uint64 {
	str := getStdin()
	rtn, _ := strconv.ParseInt(str, 10, 64)
	return uint64(rtn)
}
func getStdinInt64_2() (int64, int64) {
	list := getStdinIntArr64()
	return list[0], list[1]
}
func getStdinInt64_3() (int64, int64, int64) {
	list := getStdinIntArr64()
	return list[0], list[1], list[2]
}
func getStdinIntArr() []int {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.Atoi(val)
	}
	return rtn
}
func getStdinIntArr64() []int64 {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int64, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.ParseInt(val, 10, 64)
	}
	return rtn
}
func getStdinIntArrU64() []uint64 {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]uint64, len(list))
	for idx, val := range list {
		r, _ := strconv.ParseInt(val, 10, 64)
		rtn[idx] = uint64(r)
	}
	return rtn
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}
func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}
func abs64(n int64) int64 {
	if n < 0 {
		return -n
	}
	return n
}
func readLine() string {
	buf := make([]byte, 0, 0)
	for {
		l, p, _ := sc.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}


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

typedef long long int ll;
typedef vector<long long>lve;
typedef vector<pair<ll,ll> > lvp;
typedef vector<pair<string,ll> > svp;

#define sp         ' '
#define endl       '\n'
#define F          first
#define S          second
#define pp         pop_back`
#define pb         push_back
#define mp         make_pair 
#define GCD(x,y)   __gcd(x,y)
#define PI         2*acos(0.0);
#define lb         lower_bound
#define bs         binary_search
#define all(x)     x.begin(),x.end()
#define LCM(x,y)   ((x*y)/__gcd(x,y))
#define btpc       __builtin_popcountll
#define spc(x)     cout<<fixed<<setprecision(x)

const   long long  cs=2e5+5;
const   long long  inf=1e18;
const   long long  mod=1e9+7;
void solve()
{
    ll t,n,m,a,b,c,d,e,i,j,ky,z,cnt=0,cnt1=0;
    bool flag = false;

    cin >> n;
    vector<long long> v(n),v1(n+1,0);
    for(auto &a1:v)
        cin>>a1;
    for(i=0;i<n;i++)
    {
        v1[i+1]=v[i]+v1[i];
    }
    ll ans = 0;
    for(i=0;i<n;i++){
        t = v1[n] - v1[i+1];
        t %= mod;
        ans += v[i]*t;
        ans %= mod;
    }
 
    cout << ans << endl;

}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);    cout.tie(NULL);

    // freopen ("input.txt","r",stdin);
    // freopen ("output.txt","w",stdout);

    // ll tc;
    // cin>>tc;
    // while(tc--)
    solve();

    return 0;
}

Measured memory_bytes: 6360
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

const int N=55;

int n,a[N],tot;
pair<int,int> ans[N*2];

int read()
{
    int x=0,f=1;char ch=getchar();
    while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

void solve1()
{
	for (int i=2;i<=n;i++) a[i]+=a[i-1],ans[++tot]=make_pair(i-1,i);
}

void solve2()
{
	for (int i=n-1;i>=1;i--) a[i]+=a[i+1],ans[++tot]=make_pair(i+1,i);
}

int main()
{
	n=read();int mn=1,mx=1;
	for (int i=1;i<=n;i++) a[i]=read(),mn=a[i]<a[mn]?i:mn,mx=a[i]>a[mx]?i:mx;
	if (a[mn]<0&&a[mx]>0)
	{
		if (-a[mn]>a[mx])
		{
			for (int i=1;i<=n;i++) if (a[i]>0) a[i]+=a[mn],ans[++tot]=make_pair(mn,i);
			solve2();
		}
		else
		{
			for (int i=1;i<=n;i++) if (a[i]<0) a[i]+=a[mx],ans[++tot]=make_pair(mx,i);
			solve1();
		}
	}
	else if (a[mn]>=0) solve1();
	else solve2();
	printf("%d\n",tot);
	for (int i=1;i<=tot;i++) printf("%d %d\n",ans[i].first,ans[i].second);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
main(){
  int i,j,n,code;
  char cm[7],o,dict[262145];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",cm);
    j=0; code=0;
    while(j<=8){
      scanf("%c",&o);
      if(o=='\n') break;
      else if(o=='A') code+=1*pow(4,j);
      else if(o=='C') code+=2*pow(4,j);
      else if(o=='G') code+=3*pow(4,j);
      else if(o=='T') code+=4*pow(4,j);
      else j--;
      j++;
    }
    if(cm[0]=='i')
      dict[code]=1;
    if(cm[0]=='f')
      dict[code]?printf("yes\n"):printf("no\n");
  }
  return 0;
}

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

using namespace std;

int main(){
  int64_t l1=2, l2=1, l, n;
  
  cin>>n;
  
  for(int i=0;i<=n;i++){
    if(i==0){
    	l=l1;
    }
    else if(i==1){
    	l=l2;
    }
    else{
  		l=l1+l2;
   	 	l1=l2;
    	l2=l;
    }
    //cout<<i<<endl<<l<<endl;
  }  
  cout<<l<<endl;
  
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        int[] A = convertInt(sc.nextLine().split(" "));
        printA(A);
        insertionSort(A, n);
    }

    static void printA(int[] A) {
        int cnt = 1;
        for (int n : A) {
            System.out.print(n);
            if (cnt < A.length) {
                System.out.print(" ");
            }
            cnt++;
        }
        System.out.println("");
    }

    static int[] convertInt(String[] args) {
        int[] intA = new int[args.length];
        for (int i = 0; i < args.length; i++) {
            intA[i] = Integer.parseInt(args[i]);
        }
        return intA;
    }

    static void insertionSort(int[] A, int n) {
        for (int i = 1; i < n; i++) {
            int v = A[i];
            int j = i - 1;
            while (j >= 0 && A[j] > v) {
                A[j + 1] = A[j];
                j--;
            }
            A[j + 1] = v;
            printA(A);
        }
    }
}



Measured memory_bytes: 33872
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using boost::multiprecision::cpp_int;
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

typedef long long ll;
typedef pair<ll, ll> p;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int k, a, b;
  cin >> k >> a >> b;
  for (int i = a; i <= b; ++i) {
    if(i % k == 0){
      cout << "OK" << endl;
      return 0;
    }
  }
    cout << "NG" <<endl;
}


Measured memory_bytes: 3648
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]

k=int(input())
if k==0:
    print(2)
    print("1 1")
elif k==1:
    print(2)
    print("2 0")
elif k>=50:
    syou=k//50
    amari=k%50
    print(50)
    lst=[49+syou-1]*50
    lst[0]+=1
    for i in range(50):
        if i<amari:
            lst[i]+=50-amari+1
        else:
            lst[i]-=amari
    print(" ".join(map(str,lst)))
else:
    print(k)
    lst=[[] for i in range(k)]
    lst[0]=k
    for i in range(k-1):
        lst[i+1]=k-1
    print(" ".join(map(str,lst)))

Measured memory_bytes: 64364
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int i,a,b,c,sum=0;
    cin>>a>>b>>c;
    for(i=0;i<b;i++){
    sum+=a%b;
    if(sum%b==c){
    cout<<"YES"<<endl;
    return 0;
    }
    }
    cout<<"NO"<<endl;
}


Measured memory_bytes: 256
#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 FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1e15;

int main() {
  ll n;
  cin >> n;
  ll ans = 0;
  FOR(i, 1, n + 1) {
    if (i % 3 != 0 && i % 5 != 0) {
      ans += i;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
N = int(input())

str_list = list(map(int,input().split()))

sum0 = str_list[0]

for n in range(0,N):
    if str_list[n] == 0:
        sum0 = 0

for n in range(1,N):
    if sum0 == 0:
        break
    sum0 = sum0 * str_list[n]
    if sum0 > 10 ** 18:
        sum0 = -1
        break

print(sum0)

Measured memory_bytes: 21580
#pragma GCC optimize("Ofast","inline","-ffast-math")
#pragma GCC target("avx,sse2,sse3,sse4,mmx")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#define int long long
#define INF 1000000000000000007ll
using namespace __gnu_pbds;
using namespace std;

int n,a,b,c,d;
cc_hash_table<int,int> mp,vis;

inline void dfs(int x,int cost)
{
	if(!vis[x]){
		vis[x]=1;mp[x]=cost;
	}
	else{
		if(mp[x]>cost) mp[x]=cost;
		else return;
	}
	if(x==0) return;
	dfs(0,cost+x*min(d,INF/x));
	dfs(x/2,cost+a+(x%2)*d);
	dfs(x/2+1,cost+a+(2-x%2)*d);
	dfs(x/3,cost+b+(x%3)*d);
	dfs(x/3+1,cost+b+(3-x%3)*d);
	dfs(x/5,cost+c+(x%5)*d);
	dfs(x/5+1,cost+c+(5-x%5)*d);
} 

signed main()
{
	ios::sync_with_stdio(false);
	int t;
	cin>>t;
	while(t--){
		cin>>n>>a>>b>>c>>d;
		mp.clear();vis.clear();
		dfs(n,0);
		cout<<mp[0]<<endl;
	}
	return 0;
}

Measured memory_bytes: 5872
#include<cstdio>
#include<algorithm>
using namespace std;

char a[4];

int main()
{
	scanf("%s",a+1);
	sort(a+1,a+4);
	if(a[1]=='a'&&a[2]=='b'&&a[3]=='c')
		printf("Yes\n");
	else  printf("No\n");
	return 0;
}

Measured memory_bytes: 128