akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<28)-1
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n, w, z, answ, ansz;
vector<int> a;
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> n >> z >> w;
    a.resize(n);
    rep(i, 0, n) cin >> a[i];
    if (n == 1) {
        cout << abs(a[0] - w) << endl;
    } else {
        cout << max(abs(a[n-1]-w), abs(a[n-2]-a[n-1])) << 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;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  set<char> chs;
  vector<char> ans;
  for(int i = 0; i < S.size(); i++) {
    chs.insert(S[i]);
  }
  for(char i = 'a'; i <= 'z'; i++) {
    if(!chs.count(i)) {
      cout << i << endl;
      return 0;
    }
  }
  cout << "None" << endl;
  return 0;
}

Measured memory_bytes: 512
(N,),A,*Q=$<.map{_1.split.map &:to_i}
B=[i=0]*-~N
f=->i,x{(B[i]+=x;i+=i&-i)until i>N}
g=->i{s=0;i&=i-1while i>0&&s+=B[i];s}
A.map{f[i+=1,_1]}
Q.map{_1<1?f[_2+1,_3]:p(g[_3]-g[_2])}

Measured memory_bytes: 91828
#include <iostream>
#include <fstream>
#include <utility>
#define REP(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

typedef long long ll;

int main()
{

    ll n;
    cin >> n;

    ll ans = 1e18;
    for (ll i = 1; i * i <= n; ++i)
    {
        if (n % i != 0)
            continue;

        ll j = n / i;
        ans = min(ans, i + j - 2);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;

const int mod = 1000000007;
int add(int a, int b) { return (a += b) < mod? a : a - mod; }
int sub(int a, int b) { return (a -= b) >=  0? a : a + mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
void adds(int& a, int b) { a = add(a, b); }
void subs(int& a, int b) { a = sub(a, b); }
void muls(int& a, int b) { a = mul(a, b); }
void maxs(int& a, int b) { a = max(a, b); }
void mins(int& a, int b) { a = min(a, b); }
int pwr(int a, ll p) {
    if (p == 0) return 1;
    if (p & 1) return mul(a, pwr(a, p - 1));
    return pwr(mul(a, a), p / 2);
}
int inv(int a) { return pwr(a, mod - 2); }

int n, a[30][30], dp[1 << 22];

int f(int mask)
{
    int j = __builtin_popcount(mask), sum = 0;
    if (j == n) return 1;
    if (dp[mask] != -1) return dp[mask];
    for (int i = 0; i < n; ++i)
        if (a[i][j] && !(mask & (1 << i)))
            adds(sum, f(mask | (1 << i)));
    return dp[mask] = sum;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < n; ++j)
            cin >> a[i][j];

    memset(dp, -1, sizeof dp);
    cout << f(0);
}


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

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        //110110011
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        long b=sc.nextLong()-1;
        long a=sc.nextLong();
        long ans=0,t=2,n;
        
        for (int i = 0; i < 60; i++) {

            	n=(a/t)*(t/2)+ max(a%t-(t/2-1),0) -(b/t)*(t/2) - max(b%t-(t/2-1),0);
        	if(n%2==1) {
        		db(t);
        		ans|= 1L<<(i);        		
        	}
        	t*=2;
		}

        out.println(ans);
        out.flush();
    }



    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}

//class P {
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//}

class P implements Comparable<P>{
    int id,T;
    P(int id, int T) {
        this.id=id;
        this.T=T;
    }
    public int compareTo(P p){
        return -T+p.T; //des
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
    	int r[] = new int[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextInt(); 
		}
    	return r;
    }
    public long[] nextLongArray(int size) throws IOException{
    	long r[] = new long[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextLong(); 
		}
    	return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 24660
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder105 {
    class Program {
        static void Main(string[] args) {
            string input = Console.ReadLine();
            int n = Convert.ToInt32(input);
            var divisor = new Divisor();
            int ans = divisor.Count(n, 8);
            Console.WriteLine(ans);
        }
    }
    public class Divisor {
        public int Count(int n) {
            int ans = 0;
            int max = (int)Math.Sqrt(n);
            for(int i = 1; i <= max; i += 2) {  //max以下(!)にすること
                if(n % i == 0) ans++;
            }
            return ans * 2;
        }

        public int Count(int n, int c) {
            //1 以上 n 以下の奇数のうち, 正の約数を ちょうど c 個持つようなものの個数を返す
            int ans = 0;
            for(int i = 105; i <= n; i += 2) {
                if(Count(i) == c) {
                    ans++;
                    //Console.WriteLine(i);
                }
            }
            return ans;
        }
    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000000
#define bpc(x) __builtin_popcountll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;

int main()
{
  FAST/**/
   
   ll n;
   cin>>n;
   
   map<string,ll> ma;
   ma["AC"] = 0;
   ma["WA"] = 0;
   ma["TLE"] = 0;
   ma["Re"] = 0;
   rep(n)
   {
       string s;
       cin>>s;
       ma[s]++;
   }
   
   cout<<"AC x "<<ma["AC"]<<"\n";
   cout<<"WA x "<<ma["WA"]<<"\n";
   cout<<"TLE x "<<ma["TLE"]<<"\n";
   cout<<"RE x "<<ma["RE"]<<"\n";
   return 0;        
}  
  
          
   

Measured memory_bytes: 3664
if __name__ == '__main__':
    n = int(input())
    graph = [[0 for i in range(n)] for _ in range(n)]
    for i in range(n):
        datas = [int(num) for num in input().split(' ')]
        if datas[1] > 0:
            for j in datas[2:]:
                graph[datas[0] - 1][j - 1] = 1

    for row in graph:
        print(str(row).replace(',', '').replace('[', '').replace(']', ''))


Measured memory_bytes: 5680
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<bits/stdc++.h>
using namespace std;

vector<long int> sieve(long int n){
    long int arr[n+1];
    for(long int i = 0; i <= n;++i){
        arr[i] = 1;
    }
    arr[0] = 0;
    arr[1] = 0;
    long int p= 2;
    while(p <= n){
        if(arr[p]){
            for(long int i = p*2; i <=n; i+=p){
                arr[i] = 0;
            }
        }
        p++;
    }
    vector<long int> ans;
    for(long int i = 2; i < n ; i++){
        if(arr[i]){
            ans.push_back(i);
        }
    }
    return ans;
    }
int main(){
    int a,b;
    double h, m, ang, dh, dm;
    cin>>a>>b>>h>>m;
    dh = h;
    dm = m;
    ang = abs((dm*6)-((dh*30)+(m/2)));
    ang = min(ang, 360-ang);
    cout<<fixed<<setprecision(20);
    cout<<sqrt(a*a+b*b-(2*a*b*cos(ang*(M_PI/180))))<<endl;
}

Measured memory_bytes: 4112
#include <bits/stdc++.h>
using namespace std; 
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define LINY "YES\n"
#define Liny "Yes\n"
#define LINN "NO\n"
#define Linn "No\n"
#define unordered_map umap
typedef long long ll;
typedef long double ld;
ll min(ll x,ll y){return (x<y ? x:y);}
ll max(ll x,ll y){return (x>y ? x:y);}
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){if(a<b){swap(a,b);} return a*b /gcd(a,b);}
bool isPrime(int n){if(n<2){return false;}for(int i=2;i<sqrt(n)+1;i++){if(n%i==0) return false;}return true;}

int main(){
  int N,Y; cin >>N>>Y;
  Y /= 1000;
  int least = N;
  int most = N*10;
  bool cannot = true;
  int x,y,z;
  if(Y>=least && Y<=most){
    REP(br,N+1){
      for(int bl=0;bl<=br;bl++){
        x = bl;
        y = br-bl;
        z = N-br;
        if(x*10+y*5+z==Y){
          printf("%d %d %d\n",x,y,z);
          cannot = false; break;
        }
      }
      if(!cannot) break;
    }
  }
  if(cannot){printf("-1 -1 -1\n");}
}


Measured memory_bytes: 256
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        n: usize,
        a: [u32;n]
    }
    println!("{}",
        a.iter().enumerate()
         .filter(|(i,v)| i % 2 == 0 && *v % 2 != 0).count());
}


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

int main() {

	//ifstream cin("INPUT.txt");
	//ofstream cout("OUTPUT.txt");

	int n, k, top, left, min, i;
	cin >> n >> k;
	for(i = 0; i < k; i++) {
		cin >> left >> top;
		min = left < n-left+1 ? left : n-left+1;
		min = min < top ? min : top;
		min = min < n-top+1 ? min : n-top+1;
		cout << (min%3 == 0 ? 3 : min%3) << endl;
	}

	return 0;

}

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

#define loop(n) for(int  i= 0 ; i< (n) ; i++)
#define ll long long
#define vi vector<int>
#define inf 1000000009

using namespace std;

int main()
{
    string s ; cin >> s ;


    if( (s[0]==s[1]&&s[2]==s[1]) || (s[1]==s[2]&&s[2]==s[3]) ) {
        cout <<"Yes" ;

    }
    else cout <<"No";

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int i,n,x[10000];
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        x[i]=i+1;
    }
    for(i=0;i<n;i++)
    {
        if(x[i]%3==0)
        {
            printf(" %d",x[i]);
        }
        else if(x[i]%10==3)
        {
            printf(" %d",x[i]);
        }
        else if(29<(x[i]%100) && 40>(x[i]%100))
        {
            printf(" %d",x[i]);
        }
        else if(299<(x[i]%1000) && 400>(x[i]%1000))
        {
            printf(" %d",x[i]);
        }
        else if(2999<(x[i]%10000) && 4000>(x[i]%10000))
        {
            printf(" %d",x[i]);
        }
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 2120
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <stack>
#include <queue>
#include <map>
using namespace std;
#define MAX_N 105
#define MAX_M 11
#define PI 3.14159265359
#define rep(i,n) for(int i=0; i<n; ++i)
#define INF 1001001001

typedef pair<int, int> P;

int main() {
    int s, w;
    cin >> s >> w;

    cout << (w >= s ? "unsafe" : "safe") << endl;

    return 0;
}

Measured memory_bytes: 3632
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <iterator>
#include <algorithm>
#include <cfenv>
#include <random>
#include <numeric>
#include <cmath>
#include <iosfwd>
#include <iostream>
#include <ios>
#include <streambuf>
#include <istream>
#include <ostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <cstdlib>
#include<string>
#include <bitset>

#define SIZE 20

typedef long long ll;
using namespace std;

int main(){
    char a[5];
    cin >> a;
    if(a[0] >= 'a' && a[0] <= 'z'){
        cout << "a" << endl;
    }else{
        cout << "A" << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int k , x;
  cin >> k >> x;
  for(int i = x-k+1;i<=x+k-1;i++)cout<<i<<" ";
  cout<<endl;
  return 0;
}

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

int main()
{
	int a, b;
	int n;
	bool isDuplicate = false;

	cin >> a >> b;
	cin >> n;

	for (int i = 0; i < n; i++)
	{
		int s, f;
		cin >> s >> f;

		if (a <= s && s < b) isDuplicate = true;
		if (s <= a && a < f) isDuplicate = true;
		if (a < f && f <= b) isDuplicate = true;
		if (s < b && b <= f) isDuplicate = true;
	}

	cout << isDuplicate << endl;

	return 0;
}

Measured memory_bytes: 3108
H,W,h,w = map(int,input().split())
if H%h or W%w:
    print("Yes")
    a = (10**9)//(h*w)
    ans = [[a]*W for _ in [0]*H]
    for i in range(h-1,H,h):
        for j in range(w-1,W,w):
            ans[i][j] = -a*(h*w-1)-1
    for out in ans:
        print(*out)
else:
    print("No")

Measured memory_bytes: 11704
/*

                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    prayer
*/

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"Yes\n"
#define no cout<<"No\n"


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

	int a,b;
	cin>>a>>b;
	cout<<(a>=b)*10<<endl;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
ac=[0]*n
wa=[0]*n
for i in range(m):
  p,s=input().split()
  if s=='AC' and ac[int(p)-1]==0:
    ac[int(p)-1]+=1
  elif s=='WA' and ac[int(p)-1]==0:
    wa[int(p)-1]+=1
ans=0
for i,j in zip(ac,wa):
  ans+=i*j
print(sum(ac),ans)

Measured memory_bytes: 4596
#include<bits/stdc++.h> 
using namespace std; 
typedef  pair<int, int> iPair; 
//#define mod 1000000007
#define pb push_back
typedef long long ll;
typedef long double ld;
#define FOR(i,n) for(i=0;i<n;i++)
#define FORE(i,n) for(i=0;i<=n;i++)
 
 
ll gcd(ll a , ll b)
{
   if(b==0) return a;
   a%=b;
   return gcd(b,a);
   
}
    
ll maxl(ll a,ll b){
    if(a>b)return a;
    return b;
}
 
ll minl(ll a,ll b){
    if(a>b)return b;
    return a;
}
 
ll mod = 998244353;
 
ll mulmod(ll a, ll b,ll c){ 
    ll res = 0; 
    a = a % c; 
    while (b > 0){ 
        if (b % 2 == 1){ 
            res = (res + a) % c;
        }
        a = (a * 2) % c; 
        b /= 2; 
    } 
    return res % c; 
}
 
int binarySearch(int arr[], int l, int r, int x) 
{ 
    if (r >= l) { 
        int mid = l + (r - l) / 2; 
        if (arr[mid] == x) 
            return mid; 
        if (arr[mid] > x) 
            return binarySearch(arr, l, mid - 1, x); 
        return binarySearch(arr, mid + 1, r, x); 
    } 
    return -1; 
} 
 
int a[100005];
int tree[200005];
 
void build(int st,int low,int high){
    if(low==high){
        tree[st] = a[high]%2;
        return;
    }
    int mid = low+(high-low)/2;
    build(2*st,low,mid);
    build(2*st+1,mid+1,high);
    tree[st] = tree[2*st]+tree[2*st+1];
}
 
void update(int st,int start,int end,int ind,int val){
    if(start==end){
        tree[st] = val%2;
        return;
    }
    int mid = start+(end-start)/2;
    if(ind<=mid){
        update(2*st,start,mid,ind,val);
    }
    else update(2*st+1,mid+1,end,ind,val);
    tree[st] = tree[2*st]+tree[2*st+1];
}
 
int query(int st,int start,int end,int low,int high){
    if(start>high || end<low)return 0;
    int mid = start + (end-start)/2;
    if(start==low && end==high){
        return tree[st];
    }
    if(low>mid)return query(2*st+1,mid+1,end,low,high);
    if(high<=mid)return query(2*st,start,mid,low,high);
    return query(2*st,start,mid,low,mid)+query(2*st+1,mid+1,end,mid+1,high);
}

int main()
{
        ios_base::sync_with_stdio(false);
        cin.tie(NULL),cout.tie(NULL);
        ll n;
        cin >> n;
        cout << (n*(n-1))/2 << endl;
        return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v){
  const char* dlm = "";
  for(const auto& x:v) cout << exchange(dlm, "\t") << x;
  return os;
}
int32_t main(){
  size_t n; cin>>n;
  size_t f[45];
  f[0]=1; f[1]=1;
  for(size_t i=2; i<45; ++i) f[i]=f[i-1]+f[i-2];
  cout<<f[n]<<endl;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

template <typename T>
vector<vector<T>> binomial_table(int N) {
  vector<vector<T>> mat(N + 1, vector<T>(N + 1));
  for (int i = 0; i <= N; i++) {
    for (int j = 0; j <= i; j++) {
      if (j == 0 || j == i)
        mat[i][j] = 1;
      else
        mat[i][j] = mat[i - 1][j - 1] + mat[i - 1][j];
    }
  }
  return mat;
}

int main(){
    int n, p;
    cin >> n >> p;
    int cnt=0;
    rep(i, n){
        int a;
        cin >> a;
        if(a%2){
            cnt++;
        }
    }
    vector<vector<ll>> memo = binomial_table<ll>(n);
    ll ans=0;
    int s;
    if(p){
        s = 1;
    }else{
        s = 0;
    }
    rep3(i, s, n+1, 2){
        ll tmp = memo[cnt][i];
        rep(j, n-cnt+1){
            ans += tmp * memo[n-cnt][j];
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main(void)
{
	int n;
	int temp1,temp2;
	int i1;
	int ok;

	while(1){
		cin>>n;
		if(n==0) break;

		multiset<pair<int,int> > w;
		int sum;

		for(i1=0;i1<n;i1++){
			cin>>temp1>>temp2;
			w.insert(make_pair(temp2,temp1));
		}

		sum=0;
		ok=1;
		set<pair<int,int> >::iterator it;
		for(it=w.begin();it!=w.end();it++){
			sum+=it->second;
			if(sum>it->first) ok=-1;
		}

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

Measured memory_bytes: 1184
from itertools import combinations_with_replacement
n,m,q = map(int, input().split())
abcd = [list(map(int, input().split())) for _ in range(q)]

nums = list(combinations_with_replacement(range(1,m+1), n))
ans = 0
for i in nums:
  s = 0
  for j in abcd:
    if i[j[1]-1] - i[j[0]-1] == j[2]:
      s += j[3]
  ans = max(ans, s)
print(ans)

Measured memory_bytes: 21480
s=list(input())
k=int(input())

#k個の候補を持つ
kouho=["zzzzzzz"]*k

for i in range(len(s)):
    tmp=""
    if s[i]<kouho[-1]:
        for j in range(min(k,len(s)-i)):
            tmp+=s[i+j]
            kouho.append(tmp)

        kouho=list(set(kouho))
        kouho.sort()
        kouho=kouho[:k]

print(kouho[-1])

    



Measured memory_bytes: 9204
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int h=0;
  for(int i=0;i<s.size()/2;i++)
    if(s.at(i)!=s.at(s.size()-i-1))
      h++;
  cout<<h<<endl;
}

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

int main() {
  int N;
  cin >> N;
  
  vector<int> a(N);
  for(int i = 0; i < N; i++)
    cin >> a.at(i);
  
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  
  int sumOfFirst = 0;
  int sumOfPassive = 0;
  for(int i = 0; i < N; i += 2)
    sumOfFirst += a.at(i);
  for(int i = 1; i < N; i += 2)
    sumOfPassive += a.at(i);

  cout << sumOfFirst - sumOfPassive << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {

    int n, a;
    scanf("%d", &n);

    int min, max;
    long long sum;
    min = 1000001;
    max = -1000001;
    sum = 0;

    int i;
    for (i = 0; i < n; ++i) {
        scanf("%d", &a);
        min = a < min ? a : min;
        max = a > max ? a : max;
        sum += a;
    }
    printf("%d %d %ld\n", min, max, sum);

    return 0;
}

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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();
static constexpr const char* YES = "Yes";
static constexpr const char* NO = "No";

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);

int main(int argc, char* argv[]) {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> H(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &H[i]);
  }

  const char* ans = YES;

  H[0]--;
  rep(i, 1, N) {
    if (H[i] > H[i - 1]) H[i]--;
  }

  rep(i, 1, N) {
    if (H[i] < H[i - 1]) {
      ans = NO;
      break;
    }
  }

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

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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 A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}


Measured memory_bytes: 1024
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

class xplace {
public:
	int x;
	int y;
	int node;
	bool operator <(const xplace& xp)const {
		return x < xp.x;
	}
	bool operator >(const xplace& xp)const {
		return x > xp.x;
	}
};

class yplace {
public:
	int x;
	int y;
	int node;
	bool operator <(const yplace& yp)const {
		return y < yp.y;
	}
	bool operator >(const yplace& yp)const {
		return y > yp.y;
	}
};

class Edge {
public:
	int l;
	int r;
	int cost;
	bool operator <(const Edge& e)const {
		return cost < e.cost;
	}
	bool operator >(const Edge& e)const {
		return cost > e.cost;
	}
};

class UnionFind {
	vector<int>parent;
	vector<int>rank;
public:
	UnionFind(int num) {
		num++;
		parent.resize(num);
		rank.resize(num);
		for (int i = 0; i < num; i++) {
			parent[i] = i;
			rank[i] = 0;
		}
	}
	int Find(int node) {
		if (parent[node] == node)return node;
		else return parent[node] = Find(parent[node]);
	}
	void Unite(int u, int v) {
		u = Find(u);
		v = Find(v);
		if (u == v)return;
		if (rank[u] < rank[v])parent[u] = v;
		else {
			parent[v] = u;
			if (rank[u] == rank[v])rank[u]++;
		}
	}
	bool Check_Same(int u, int v) {
		return Find(u) == Find(v);
	}
};

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

	cin >> N;
	vector<xplace>xp;
	vector<yplace>yp;
	for (int i = 0; i < N; i++) {
		cin >> L >> R;
		xplace x;
		x.node = i;
		x.x = L;
		x.y = R;
		yplace y;
		y.node = i;
		y.x = L;
		y.y = R;
		xp.push_back(x);
		yp.push_back(y);
	}
	sort(xp.begin(), xp.end());
	sort(yp.begin(), yp.end());
	vector<Edge>edge;
	for (int i = 0; i < N - 1; i++) {
		Edge e;
		e.l = xp[i].node;
		e.r = xp[i + 1].node;
		e.cost = min(abs(xp[i].x - xp[i + 1].x), abs(xp[i].y - xp[i + 1].y));
		edge.push_back(e);
		e.l = yp[i].node;
		e.r = yp[i + 1].node;
		e.cost = min(abs(yp[i].x - yp[i + 1].x), abs(yp[i].y - yp[i + 1].y));
		edge.push_back(e);
	}
	sort(edge.begin(), edge.end());
	UnionFind uf(N);
	long long int ans = 0;
	for (auto i : edge) {
		if (uf.Check_Same(i.l, i.r)) {
			continue;
		}
		uf.Unite(i.l, i.r);
		ans += i.cost;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 7340
//#include <bits/stdc++.h> // header file includes every Standard library
#include<iostream>
#include<vector>
#define MOD 1000000007
using namespace std;
int main() {
	long long int n;
	cin>>n;
	vector<long long int>a(n,0);
	for(int i=0;i<n;i++)
		cin>>a[i];
	long long int sum=a[0],need=0;
	for(int i=1;i<n;i++){
		need=(need+a[i]*sum)%MOD;
		sum=(sum+a[i])%MOD;
	}
	cout<<need;
	return 0;
}

Measured memory_bytes: 4460
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <functional>
#define scanf(...) scanf(__VA_ARGS__)+1
using namespace std;

int main(){
	char S[20];

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

	int len = strlen(S);
	int max = 0;
	int count = 0;
	for (int i = 0; i < len; i++) {
		if (S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T') {
			count++;
		} else {
			max = (count > max) ? count : max; 
			count = 0;
		}
	}
	max = (count > max) ? count : max; 

	printf("%d", max);
	
	return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;

int main(void) {
    ll A, B, C;
    ll c = 0;
    cin >> A >> B >> C;
    for(ll i = 0;i < B;i++) {
        if(A * i % B == C) {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
import math

N,M = map(int,input().split())
#Nは偶数
#Mは奇数

#偶数偶数
if N >= 2:
  Nf = math.factorial(N)//(math.factorial(N-2)*2)
else:
  Nf = 0
#奇数奇数
if M >= 2:
  Mf = math.factorial(M)//(math.factorial(M-2)*2)
else:
  Mf = 0
ans = int(Nf + Mf)
print(ans)


Measured memory_bytes: 9096
def get_max_value(n, W, v, w):
	dp = [[0 for x in range(W+1)] for x in range(n+1)]
	for i in range(1,n+1):
		wt = w[i-1]
		vl = v[i-1]
		for j in range(1,W+1):
			if wt > j:
				dp[i][j]=dp[i-1][j]
			else:
				dp[i][j]=max(dp[i-1][j], dp[i-1][j-wt]+vl)
	return dp[n][W]

n, W = map(int, input().split())
v = [0]*n
w = [0]*n
for i in range(n):
	v[i], w[i] = map(int, input().split())
print(get_max_value(n, W, v, w))



Measured memory_bytes: 25936
#include<bits/stdc++.h>
#define fr(i,c,b) for(int i=c;i<b;i++)
#define frl(i,c,b) for(ll i=c;i<b;i++)
#define si(x) int x; scanf("%d", &x)
#define sll(x) ll x; scanf("%lld", &x)
#define pi(x) printf("%d", x)
#define pll(x) printf("%lld", x)
#define nl printf("\n")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define MAX 100001
#define M 1000000007
#define pb push_back

typedef long long int ll;

using namespace std;

int main()
{
    string s; cin>>s;
    unsigned long long ans;
    for(auto i:s)
    {
        ans+=i-'0';
    }
    if(ans%9==0)
        cout<<"Yes";
    else
        cout<<"No";
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef int64_t Int;

const Int INF = 1e18;

vector<Int> P, Ng, Z;
Int K;

//PとNgから1つずつ選んだものの積がx以上になるようなものの個数がK以上ならTrue
bool PtimesNg(Int x) {
    Int sum = 0;
    rep(i, P.size()) {
        Int d = (x + P[i] - 1) / P[i];
        sum += Ng.end() - lower_bound(Ng.begin(),Ng.end(), d);
    }
    return (sum >= K);
}

//Pから2つ、ないしNgから2つ選んだものの積がx以上になるようなものの個数がK以上ならTrue
bool PtimesP_NgtimesNg(Int x) {
    Int sum = 0;
    rep(i, P.size()) {
        Int d = (x + P[i] - 1) / P[i];
        Int temp = P.end() - lower_bound(P.begin(), P.end(), d);
        if (temp + i >= P.size()) temp--;
        sum += temp;
    }

    rep(i, Ng.size()) {
        Int d = (x + Ng[i] - 1) / Ng[i];
        Int temp = Ng.end() - lower_bound(Ng.begin(), Ng.end(), d);
        if (temp + i >= Ng.size()) temp--;
        sum += temp;
    }

    sum /= 2;

    return (sum >= K);
}

int main(){ 
    Int N, p, n, z, negative, zero, positive, p_max = 0, n_max = 0;
    cin >> N >> K;

    rep(i,N) {
        Int A; cin >> A;
        if (A > 0) P.push_back(A);
        else if (A < 0) Ng.push_back(-A);
        else Z.push_back(A);
    }

    sort(P.begin(), P.end());
    sort(Ng.begin(), Ng.end());

    p = P.size();
    n = Ng.size();
    z = Z.size();

    //cout << p << " " << z << " " << n << endl;


    negative = n * p;
    positive = p * (p-1) / 2 + n * (n-1) / 2;
    zero = z * (n + p) + z * (z-1) / 2;


    //二分探索
    if (K <= negative) {
        Int U = INF, B = 1;
        while (U - B > 1) {
            Int mid = (U + B) / 2;
            if (PtimesNg(mid)) B = mid;
            else U = mid;
        }
        cout << -B << endl;
    }

    else if (K <= negative + zero) {
        cout << 0 << endl;
    }

    else {
        K = N * (N-1) / 2 - K + 1;
        Int U = INF, B = 1;
        while (U - B > 1) {
            Int mid = (U + B) / 2;
            if (PtimesP_NgtimesNg(mid)) B = mid;
            else U = mid;
        }
        cout << B << endl;
    }
}


Measured memory_bytes: 2548
#include <iostream>
#include <vector>
#include <string>
using ll = long long;
using namespace std;

int main()
{
  ll mod = 1000000007;
  string s;
  cin >> s;
  ll n = s.size();
  vector<vector<ll>> dp(n + 1, vector<ll>(4, 0));
  
  for (ll j = 0; j < 4; j++)
  {
    dp[n][j] = (j == 3);
  }

  for (ll i = n - 1; i >= 0; i--)
  {
    // cerr << "[" << i << "]" << s[i] << ":\t";
    for (ll j = 0; j < 3; j++)
    {
      if (s[i] == '?')
      {
        dp[i][j] =( (dp[i + 1][j] * 3 % mod) + dp[i + 1][j + 1] )%mod;
      }
      else if (s[i] == ('A' +  j ) )
      {
        dp[i][j] =( dp[i + 1][j] + dp[i + 1][j + 1])%mod;
      }
      else
      {
        dp[i][j] = dp[i + 1][j];
      }
      // cerr << dp[i][j] << ",";
    }

    dp[i][3] = ((s[i] == '?' ? 3ll : 1ll) * dp[i + 1][3])%mod;

    // cerr << dp[i][3] << endl;
  }

  cout << dp[0][0] << endl;
  return 0;
}

Measured memory_bytes: 7424
import numpy as np
import scipy.sparse
N,X,Y = (int(x) for x in input().split())
lil = scipy.sparse.lil_matrix((N, N), dtype = int)
for i in range(N-1):
    lil[i, i+1] = 1
    lil[i+1, i] = 1
lil[X-1, Y-1] = 1
lil[Y-1, X-1] = 1
lil2 = scipy.sparse.csgraph.dijkstra(lil, directed = False).astype(int)
ans = np.bincount(lil2.ravel(), minlength = N) // 2
for i in range(1,N):
    print(ans[i])

Measured memory_bytes: 77152
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		final int q = sc.nextInt();
		for(int tt = 0; tt < q; tt++){
			char[] c1 = sc.next().toCharArray();
			char[] c2 = sc.next().toCharArray();
			
			int[][] DP = new int[c1.length + 1][c2.length + 1];
			for(int i = 1; i <= c1.length; i++){			
				for(int j = 1; j <= c2.length; j++){
					if(i != 0){ DP[i][j] = Math.max(DP[i][j], DP[i - 1][j]); }
					if(j != 0){ DP[i][j] = Math.max(DP[i][j], DP[i][j - 1]); }
					if(i != 0 && j != 0){ DP[i][j] = Math.max(DP[i][j], DP[i - 1][j - 1] + (c1[i - 1] == c2[j - 1] ? 1 : 0)); }
				}
			}
			
			System.out.println(DP[c1.length][c2.length]);
		}
	}

	public static class Scanner {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public void close() throws IOException {
			br.close();
		}
	}

}

Measured memory_bytes: 58904
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;

typedef long long ll;

int main() {
#if __APPLE__
    //freopen("A.in", "r", stdin);
    //freopen("A.out", "w", stdout);
#endif

    int n, m;
    scanf("%d%d", &n, &m);

    vector<int> cnt(n);
    for (int i = 0; i < m; ++i) {
        int a, b;
        scanf("%d%d", &a, &b);
        --a, --b;
        ++cnt[a];
        ++cnt[b];
    }

    bool ok = true;
    for (int i = 0; i < n; ++i) {
        ok &= !(cnt[i] & 1);
    }

    if (ok) {
        puts("YES");
    } else {
        puts("NO");
    }
}


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

int main(){
    double N, T, A;
    double H[1100];
    cin >> N >> T >> A;

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

    double alpha = 0.006;
    double min_diff = abs(A - (T - H[0] * alpha));
    int res = 1;

    for(int i = 1; i < N; ++i){
        double diff = abs(A - (T - H[i] * alpha));

        if(diff < min_diff) {
            min_diff = diff;
            res = i + 1;
        }
    }

    cout << res << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>

// this require C++11
//#include <unordered_set>
//#include <unordered_map>
//#include <random>

using namespace std;

#define all(c) c.begin(),c.end()
#define repeat(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define debug(x) #x << "=" << (x)
#define dump(x) cerr << debug(x) << " (L:" << __LINE__ << ")"<< endl

typedef long long ll;
typedef vector<int> vi;

template<typename T>
ostream& operator<<(ostream& os,vector<T>& vec){
    typename vector<T>::iterator it,endit=vec.end();
    os << "[";
    for(it=vec.begin();it!=endit;it++){
        os << " " << *it << ",";
    }
    os << "]";
    return os;
}

template<typename T>
T input(){
    T t;cin >> t;
    return t;
}

template<typename T>
vector<T> input(const int N){
    vector<T> v(N);
    repeat(i,N) cin >> v[i];
    return v;
}



int main(){
	int tmpi;
	for(;;){
		int n=input<int>();
		if(n==0)break;
		int U=1,S=2,E=3,ans=1;
		repeat(i,n){
			string tmp=input<string>();
			      if(tmp=="North"){
				tmpi=U;
				U=S;
				S=7-tmpi;
			}else if(tmp=="East"){
				tmpi=E;
				E=U;
				U=7-tmpi;
			}else if(tmp=="West"){
				tmpi=U;
				U=E;
				E=7-tmpi;
			}else if(tmp=="South"){
				tmpi=S;
				S=U;
				U=7-tmpi;
			}else if(tmp=="Right"){
				tmpi=S;
				S=E;
				E=7-tmpi;
			}else if(tmp=="Left"){
				tmpi=E;
				E=S;
				S=7-tmpi;
			}
			ans += U;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1212
#include <iostream>
#include <cctype>
#include <string>

using namespace std;

int main(){
	string number;
	int sum = 0;
	while (1){
		cin >> number;
		if (number == "0") break;
		for (int i = 0; i < number.size(); i++){
			sum += (int)(number[i] - '0');
		}
		cout << sum << endl;
		sum = 0;
	}
}

Measured memory_bytes: 1188
N, Y = [int(x) for x in input().split()]
# N < 2000

def solve(N, Y):
    for a in range(0, N+1):
        rem = Y - a * 10000
        if rem < 0:
            break
        for b in range(0, N+1-a):
            if rem - b * 5000 < 0:
                break
            c, r =  divmod(rem - b * 5000, 1000)
            #print(a, b, c, r)
            if r == 0 and c == (N - a - b):
                return a, b, c
    return -1, -1, -1

print(*solve(N, Y))





Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define Abra_Ka_Dabra ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using namespace std;

const long long mod = 1e9 + 7;
const double PI = acos(-1);
const double EPS = 1e-9;

int main() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif

	Abra_Ka_Dabra

	string x;
	cin>>x;
	if(x[x.size()-1]=='s') cout<<x<<"es\n";
	else cout<<x<<"s\n";


	return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#define sign(x) ((x==0)?1:-1)

int main(){
	int n;
	cin>>n;
	vector<long long> a(n);
	for(int i=0;i<n;i++)cin>>a[i];
	
	vector<long long> b=a;
	long long ans[2] = {0,0};
	for(int j=0;j<2;j++){
		if(j==0){
			if(a[0]<=0){
				ans[0]+=1-a[0];
				a[0]=1;
			}
		}
		else{
			if(a[0]>=0){
				ans[1]+=a[0]+1;
				a[0]=-1;
			}
		}
		for(int i=1;i<n;i++){
			a[i]+=a[i-1];
			if(a[i]<0&&a[i-1]<0){
				ans[j]+=1-a[i];
				a[i]=1;
			}
			if(a[i]>0&&a[i-1]>0){
				ans[j]+=a[i]-(-1);
				a[i]=-1;
			}
			if(a[i]==0){
				ans[j]++;
				if(a[i-1]<0)a[i]=1;
				else a[i]=-1;
			}
		}
		a=b;
	}
	cout<<min(ans[0],ans[1])<<endl;
	
	
	
	
	return 0;
}


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

int main(){
    int W,H,x,y,r;

    cin >> W >> H >> x >> y >> r;

    if( 0 <= x-r && 0 <= y - r && W >= x + r && H >= y + r ) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
#define int long long
#define uint unsigned int
#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, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) ((int)(a).size())
#define PB(a) push_back(a)
#define EMP emplace
#define EMPB(...) emplace_back(__VA_ARGS__)
#define MP(a, b) make_pair(a, b)
#define MT(...) make_tuple(__VA_ARGS__)
#define Bit(n) (1LL << (n))
using namespace std;
using pii = pair<int, int>;
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
const int MOD = 1000000007;
const int INF = 1LL << 30;
const double EPS = 1e-10;

int N, A, B;
int P[110];
int cnt[3];

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N >> A >> B;
  REP(i, N) {
    cin >> P[i];
    if (P[i] <= A) cnt[0]++;
    else if (P[i] <= B) cnt[1]++;
    else cnt[2]++;
  }
  int ans = INF;
  REP(i, 3) {
    chmin(ans, cnt[i]);
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n,k;

int main(void){
	scanf("%d%d",&n,&k);
	int cnt=0;
	while(n>0){
		cnt++;
		n/=k;
	}
	printf("%d\n",cnt);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll n;
  	ci(n)
  vll A(n);
  FOR(i,0,n){
    ci(A[i])
  }
  vll B(n);
  rFOR(i,n,0){
    rFOR(j,i,0){
      if(A[j-1]==j){
        B[i-1]=j;
        A.erase(A.bgn+j-1);
        break;
      }
    }
  }
  if(B[0]==0){
    co(-1)
  }
  else{
    FOR(i,0,n){
      co(B[i])
    }
  }
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

ll mod(ll a){
  return (a % 1000000007);
}

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


int main(){
  string s; cin >> s;
  ll n = s.size();
  
  if(n == 7){
    if(s == "keyence") cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  
  else{
    for(ll i=0; i < 8; i++){
      string ans = "";
      
      for(ll j=0; j < i; j++){
        ans += s[j];
      }
      for(ll j=0; j < 7-i; j++){
        ans += s[n-(7-i)+j];
      }
      
      if(ans == "keyence"){
        cout << "YES" << endl;
        return 0;
      }
    }
    
    cout << "NO" << endl;
  }
  
}

Measured memory_bytes: 256