akhauriyash/Code-Regression huggingface dataset:
#include <cstdlib>
#include <iostream>
#include <string>
#include <time.h>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;

int main(void) {

	//string s1,s2,s3;
	long long N = 0, M = 0;
	cin >> N >> M;

	long long res = (N - 2)*(M - 2);

	res = llabs(res);
	/*int res = 0;
	bool *card;
	card = (bool *)malloc(sizeof(bool *)*(N+2)*(M+2));

	for (int j = 1; j <= N; j++) {
		for (int i = 1; i <= M; i++) {
			card[i*(M+2) + j] = true;
		}
	}
	
	for (int j = 1; j <= N; j++) {
		for (int i = 1; i <= M; i++) {
			card[i*(M + 2) + j - (M+2) - 1] = !card[i*(M + 2) + j - (M + 2) - 1];
			card[i*(M + 2) + j - (M + 2)] = !card[i*(M + 2) + j - (M + 2)];
			card[i*(M + 2) + j - (M + 2) + 1] = !card[i*(M + 2) + j - (M + 2) + 1];
			card[i*(M + 2) + j - 1] = !card[i*(M + 2) + j - 1];
			card[i*(M + 2) + j] = !card[i*(M + 2) + j];
			card[i*(M + 2) + j + 1] = !card[i*(M + 2) + j + 1];
			card[i*(M + 2) + j + (M + 2) - 1] = !card[i*(M + 2) + j + (M + 2) - 1];
			card[i*(M + 2) + j + (M + 2)] = !card[i*(M + 2) + j + (M + 2)];
			card[i*(M + 2) + j + 1 + (M + 2)] = !card[i*(M + 2) + j + 1 + (M + 2)];

		}
	}

	for (int j = 1; j <= N; j++) {
		for (int i = 1; i <= M; i++) {

			if (card[i*(M + 2) + j] == false) {
				res++;
			}
		}
	}
*/
	cout << res << endl;


	


	return 0;




}

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

#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);

int main() {
    fast_io;
    int a,b;
    cin>>a>>b;

    double tax1,tax2;
    tax1=0.08;
    tax2=0.1;
    double ans;

    for(double i=1;i<=1250;i++) {
        double a1=(i*tax1);
        double a2=(i*tax2);
        //cout<<a1<<endl;
        if(double(floor(a1))==a&&double(floor(a2)==b)) {
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
}




Measured memory_bytes: 3752
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<set>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
 
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

int main(){
	int N,maxa=0,maxb=0;
	cin>>N;
	rep(i,N){
		int a,b;
		cin>>a>>b;
		if(a>maxa){
			maxa=a;
			maxb=b;
		}
	}
	cout<<maxa+maxb<<endl;
}



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

typedef long long int lli;
#define pb push_back
#define gcd __gcd
#define MOD 1000000007
#define mod2 998244353
#define forz(i,n) for(long long int i=0;i<n;i++)
char A[51][51];
set<pair<lli,lli>> s1,s2;
set<pair<lli,lli>>::iterator i1,i2;

lli mod(lli a){
    if(a<0) return -1*a;
    return a;
}

bool comp(pair<lli,lli> a,pair<lli,lli> b){
    return 0;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli t=1,u,j;
    //cin>>t;
    for(u=1;u<=t;u++){
        lli n,m,i,j,p=0,c,q,k,a,b,ne=0,p1=0,p2=0,p3=0,p4=0,q1=0,k1,k2,a1,a2,x,y;
        cin>>n;
        for(i=1;i<=n;i++){
            cin>>m;
            if(i%2!=0 & m%2!=0) p++;
        }
        cout<<p<<endl;
    }
}

Measured memory_bytes: 3612
#include<stdio.h>

#define N 200010

int main(){

//long string memory err?
 char a[N];//s
 char b[N];//t
 int total=0;
  
scanf("%s",a);
scanf("%s",b);  
  
for(int i=0; i<strlen(a); i++) if( a[i]!=b[i] ) total++;//for(int i=0; i<strlen(a); i++) if( a[i]=!b[i] ) total++;

  printf("%d\n",total);
  
return 0;
}


Measured memory_bytes: 2532
#include <iostream>
#include <string.h>

using namespace std;

struct Node {
    int key;
    Node *prev, *next;
};

class DoublyLinkedList {
public:
    DoublyLinkedList();
    void insert(int key);
    void deleteKey(int key);
    void deleteFirst();
    void deleteLast();
    void trace();
private:
    void deleteNode(Node *x);
    Node *nil;
};

DoublyLinkedList::DoublyLinkedList() {
    nil = new Node;
    nil -> next = nil;
    nil -> prev = nil;
}

void DoublyLinkedList::insert(int key) {
    Node *x;
    x = new Node;
    x -> key = key;
    x -> next = (nil -> next);
    x -> prev = nil;
    nil -> next -> prev = x;
    nil -> next = x;
}

void DoublyLinkedList::deleteKey(int key) {
    Node *x = nil -> next;
    while(x != nil && x -> key != key) {
        x = x -> next;
    }
    deleteNode(x);
}

void DoublyLinkedList::deleteFirst() {
    deleteNode(nil -> next);
}

void DoublyLinkedList::deleteLast() {
    deleteNode(nil -> prev);
}

void DoublyLinkedList::deleteNode(Node *x) {
    if(x == nil) return;
    x -> prev -> next = x -> next;
    x -> next -> prev = x -> prev;
    delete x;
}

void DoublyLinkedList::trace() {
    Node *x = nil -> next;
    while(x != nil) {
        if(x -> prev != nil) cout << " ";
        cout << x -> key;
        x = x -> next;
    }
    cout << endl;
}


int main() {
    int n;
    DoublyLinkedList L;
    string opr;
    int key;

    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> opr;
        if(opr == "insert") {
            cin >> key;
            L.insert(key);
        }
        else if(opr == "delete") {
            cin >> key;
            L.deleteKey(key);
        }
        else if(opr == "deleteFirst") L.deleteFirst();
        else if(opr == "deleteLast") L.deleteLast();
    }
    L.trace();
}


Measured memory_bytes: 34420
#include <bits/stdc++.h>
using namespace std;
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define clz(a) __builtin_clz(a) // count leading zeroes
#define ctz(a) __builtin_ctz(a) // count trailing zeroes
#define popc(a) __builtin_popcount(a) // count set bits (binary me 1 kitne hai) (if longlong popcount ll)
#define ln "\n"
#define dbg(x) cerr<<#x<<" = "<<x<<endl
#define dbg2(x,y) cerr<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<endl;
#define dbgstl32(v) cerr<<#v<<" = \n"; { int c=0; forstl(it,v) \
cerr<<"    Term "<< ++c <<" = "<<it<<ln;} cerr<<endl
#define dbgstlp32(v) cerr<<#v<<" = \n"; { int c=0; forstl(it,v) \
cerr<<"    Term "<< ++c <<" = "<<it.fi<<" , "<<it.se<<ln;} cerr<<endl
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define all(n) n.begin() , n.end() 
#define tfi first.first
#define tse first.second
#define tth second
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32; 
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
typedef map<int,int> m32;
typedef pair< pair<int,int> , int> tri;

#pragma GCC optimize ("-O2")
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); }
const int LIM = 2e5+5 ,MOD = 1e9+7;
//int n , m , t , x ,y ;
int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

	int n;
	cin >> n;

	ll happ[n][3];
	forn(i,n) forn(j,3) cin >> happ[i][j];

	ll dp[n][3];
	dp[0][0] = happ[0][0];
	dp[0][1] = happ[0][1];
	dp[0][2] = happ[0][2];

	forsn(i,1,n){
		forn(j,3) dp[i][j] = max( dp[i-1][(j+1)%3] + happ[i][j], dp[i-1][(j+2)%3] + happ[i][j] );
	}

	cout << max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2]));



}

Measured memory_bytes: 4992
#include<iostream>
#include<unordered_map>
#include<bitset>
#include<math.h>
#include<vector>
#include<set>
#include<algorithm>
#include<ctype.h>
#include<unordered_set>
#include<string>
#include<iomanip>
#include<queue>
#include<limits>
#include<map>
#include<stack>
#include<iterator>
#include<cstring>
#include<deque>
#include<chrono>
using namespace std;
#define pi 3.141592653589793238


#define MOD 1000000007
#define INF 999999999999999999 
#define pb push_back
#define ff first
#define ss second
#define mt make_tuple
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define f0 get<0>
#define f1 get<1>
#define f2 get<2>
typedef vector<ll> vi;
typedef vector<vi> vvi;


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    ll T = 1, i, j;
    
    
    //cin >> T;
    while (T--) {
        ll x, y;
        cin >> x >> y;
        ll a, b;
        b = (y - 2 * x);
       
        bool ans = true;
        if(y - 2*x < 0){
            ans = false;
        }
        if((y - 2*x) % 2 != 0){
            ans = false;
        }
        b = (y - 2 *x) / 2;
        a = x - b;
        if(a < 0 || b < 0){
            ans = false;
        }
        
        if(2 * a + 4 * b != y){
            ans = false;
        }
        //cout << a <<" " << b << endl;
        if(!ans){
            cout << "No";
        }
        else{
            cout << "Yes";
        }
    }

    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
using vi = vector<int>;

int main(){
	string S; int X,Y; cin>>S>>X>>Y;

	vi dx,dy;
	char dir = 'x';
	if(S[S.size()-1]=='F') S += "T";
	int d = 0;
	rp(i, 0, S.size()){
		if(S[i]=='F') d++;
		else{
			if(dir=='x'){
				dx.push_back(d);
				dir = 'y';
			}
			else{
				dy.push_back(d);
				dir = 'x';
			}
			d = 0;
		}
	}

	// cout<<"dx ";for(auto e:dx)cout<<e<<" ";puts("");//
	// cout<<"dy ";for(auto e:dy)cout<<e<<" ";puts("\n--");//

	set<int> dp;

	bool first = true;
	dp.insert(0);
	rp(i, 0, dx.size()){
		int d = dx[i];
		set<int> t; swap(t,dp);
		for(auto x:t){
			if(!first) dp.insert(x-d);
			dp.insert(x+d);
		}
		first = false;
		// for(auto e:dp){cout<<e<<" ";}puts("");//
	}
	bool x = dp.count(X)!=0;

	// for(auto e:dp){cout<<e<<" ";}puts("\n--");//

	dp.clear();

	dp.insert(0);
	rp(i, 0, dy.size()){
		int d = dy[i];
		set<int> t; swap(t,dp);
		for(auto y:t){
			dp.insert(y-d);
			dp.insert(y+d);
		}
		// for(auto e:dp){cout<<e<<" ";}puts("");//
	}
	bool y = dp.count(Y)!=0;

	// for(auto e:dp){cout<<e<<" ";}puts("\n--");//

	cout<< (x & y? "Yes":"No") <<endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long int ll;
const ll MOD (1e9+7);
const ll INF (2e9);
const int MAX_N (200001);

int main(void) {
    int n,t;
    cin>>n>>t;
    int *a=new int[n];
    int *mina=new int[n];
    int *maxa=new int[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }

    mina[0]=a[0];
    maxa[n-1]=a[n-1];
    for(int i=1;i<n;i++){
        mina[i]=min(mina[i-1],a[i]);
        maxa[n-1-i]=max(maxa[n-i],a[n-1-i]);
    }
    int rieki=0;
    for(int i=0;i<n;i++){
        rieki=max(rieki,maxa[i]-mina[i]);
    }
    int memo=-1;
    int ans=0;
    for(int i=0;i<n;i++){
        if(rieki==maxa[i]-mina[i]&&memo!=mina[i]){
            ans++;
            memo=mina[i];
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

int num[500010],n,sum;
char s[500010];

int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);sum=0;
	for (int i=1;i<=n;i++) num[i]=s[n-i+1]-'0';
	for (int i=1;i<=n;i++) num[i]*=9;
	for (int i=1;i<=n;i++) num[i+1]+=num[i]/10,num[i]%=10;
	while (num[n+1]) n++;
	for (int i=1;i<=n;i++) sum+=num[i];
	int ans=0;
	for (int i=1;;i++)
	{
		num[1]++;sum++;
		int hh=1;
		while (num[hh]>9) num[hh+1]+=num[hh]/10,num[hh]%=10,hh++,sum-=9;
		if (sum<=i) { ans=i;break; }
	}
	printf("%d\n",ans/9+(bool)(ans%9));
	return 0;
}

Measured memory_bytes: 2688
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace B
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var nt = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            var min = 1001;
            for (var i = 0; i < nt[0]; i++)
            {
                var ct = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
                if (ct[1] <= nt[1]) min = Math.Min(ct[0], min);
            }
            Console.WriteLine(min == 1001 ? "TLE" : min.ToString());
        }
    }
}


Measured memory_bytes: 13396
#include <stdio.h>
#include <stdlib.h>

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

int main(void){
	int N;
	scanf("%d",&N);
	int a[N];
	int i,j;
	int count=0;
	for(i=0;i<N;i++){scanf("%d",&a[i]);}
	int x,y;
	
	for(i=0;i<N;i++){
		x=a[i];
		while(x%2 == 0){
			y = x/2;
			x = y;
			count++;
		}
	}
	
	printf("%d",count);
	
	return 0;}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            String line = sc.nextLine();
            String answer = "";
            int length = line.length();
            for (int i = 0; i < length; i++) {
                char ch = line.charAt(i);
                if (Character.isLowerCase(ch)) {
                    ch = Character.toUpperCase(ch);
                } else {
                    ch = Character.toLowerCase(ch);
                }
                answer = answer + ch;
                //Character.isLowerCaseで小文字かどうか判断
                //Character.toUppercase, Character.toLowerCaseで変換
            }
            System.out.println(answer);
        }
    }
}


Measured memory_bytes: 31648
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <string>
#include <math.h>

using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
static const ll maxLL = (ll)1 << 62;

ll P[100000] = {};
ll p = 0;

void createPrime() {
	ll n = 100000;
	P[0] = -1;
	P[1] = -1;
	rep(i, 2, n) {
		if (P[i] == 0) {
			rep(j, 2, n) {
				if (j*i >= n)break;
				P[j*i] = -1;
			}
		}
	}
	//rep(i, 0, n) {
	//	if (P[i] == 0) {
	//		cout << i << endl;
	//	}
	//}
}

int main() {
	ll N; cin >> N;
	createPrime();
	ll cnt = 0;
	rep(i, 0, 100000) {
		if (P[i] == 0 && i % 10 == 1) {
			cout << i;
			cnt++;
			if (cnt == N) {
				break;
			}
			else {
				cout << " ";
			}
		}
	}
	cout << endl;

	return 0;
}

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

unsigned long long int ulli;

int main(void){
    // Here your code !
    string str;
    cin >> str;
    int n = str.length();
    
    for(int i = 0; i < n-1; i++){
        if(str[i] == str[i+1]){
            cout << i+1 << " " << i+2 << endl;
            return 0;
        }
    }
    
    
    for(int i = 0; i < n-2; i++){
        if(str[i] == str[i+2]){
            cout << i+1 << " " << i+3 << endl;
            return 0;
        }
    }
    
    cout << "-1 -1" << endl;
    
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vll = vector<long long>;
using vpii = vector<pair<int,int>>;
using vivi = vector<vector<int>>;
using vbvb = vector<vector<bool>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int mod = 1000000007;
const int inf = 1001001001;

int main(void) {
  int dd[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin >> k;
  cout << dd[k-1] << endl;
  
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int M = 1e9+7;
const int N = 1e5+5;

int a[N],sum[N];
string s[N];
bool vis[N]; 

int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i = 1;i <= m;++i){
    	scanf("%d",&a[i]);
    	cin >> s[i];
    	
    	if(s[i] == "AC") vis[a[i]] = 1;
    	else{
    		if(!vis[a[i]]) sum[a[i]]++;
		}
	}
	
	int acs = 0,was = 0;
	for(int i = 1;i <= n;++i){
		if(vis[i]){
			acs++;
			was += sum[i];
		}
	}
	
	printf("%d %d\n",acs,was);
    return 0;
}

Measured memory_bytes: 7040
var lines = [];

var readline = require('readline')
var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});


rl.on('line', (x) => {
    lines.push(x)
});

rl.on('close', () => {
    var N = Number(lines[0]); lines.shift();
    var s = [];

    for (var i = 0; i < N; i++) {
        var m = lines[i].split(" ");
        s.push([m[0], Number(m[1]), i]);
    }

    s.sort((a, b) => a[0] === b[0] ? b[1] - a[1] : a[0] > b[0] ? 1 : -1);

    for (var i = 0; i < N; i++) {
        console.log(s[i][2] + 1)
    }

});

Measured memory_bytes: 7756
#include <bits/stdc++.h>
using namespace std;
int main () {
	int sum = 0;
	for (int i = 0; i < 4; ++i)
	{
		char c;
		cin >> c;
		if(c == '+'){
			sum++;
		}else{
			sum--;
		}
	}
	cout << sum << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] p = new int[N];
        int c = 0;
        for (int i = 0; i < N; i++) {
            p[i] = sc.nextInt();
        }
        for(int i=0; i < p.length-1; i++) {
            for(int j=0; j < p.length-i-1; j++) {
            	if(p[j] > p[j+1]) {
            		int asc = p[j];
            		p[j] = p[j+1];
                    p[j+1] = asc;
                }
            }
        }
        for (int i = 0; i < K; i++) {
            c = c + p[i];
        }
        System.out.println(c);
    }
}

Measured memory_bytes: 38760
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Numerics;

namespace abc152
{
    class Program
    {
        static void Main(string[] args)
        {
            //Console.SetIn(new StreamReader("input.txt"));
            solve_abc152B();
        }

        public static void solve_abc152B()
        {
            int[] ab = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int a = ab[0];
            int b = ab[1];
            string a1s = String.Empty;
            string b1s = string.Empty;
            for (int i = 0; i < b; i++)
            {
                a1s += a.ToString();
            }
            for (int i = 0; i < a; i++)
            {
                b1s += b.ToString();
            }

            if (Convert.ToInt64(a1s) > Convert.ToInt64(b1s))
            {
                Console.WriteLine(a1s);
            }
            else
            {
                Console.WriteLine(b1s);

            }
        }

        public static void solve_abc152A()
        {
            int[] nm = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            Console.WriteLine(nm[0] == nm[1] ? "Yes" : "No");            
        }
    }
}


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

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

    rep(i, k) cout << "ACL";
    cout << '\n';
    return 0;
}


Measured memory_bytes: 3524
#include<stdio.h>
int main(){
    int H=0,W=0,i=0,j=0,t=0,u=0;
    for(;scanf("%d %d",&H,&W),H;puts("")){
        for(i=0,t=H-1;i<H;i++,t--){
            for(j=0,u=W-1;j<W;j++,u--){
                printf("%s%s",i*j*t*u?".":"#",j==W-1?"\n":"");
            }
        }
    }
}

Measured memory_bytes: 1736
#include <iostream>
#include <algorithm>
#include <cstdio> 
#include <climits>
using namespace std;

const int N = 200005;
int r[N];
int main()
{
	int n;cin >> n;
	for(int i = 0;i < n;++i)
		scanf("%d",&r[i]);
	int res = INT_MIN,minv = r[0];
	for(int i = 1;i < n;++i)
	{
		res = max(res,r[i] - minv);
		minv = min(minv,r[i]);
	}
	cout << res << endl;
	return 0;
} 


Measured memory_bytes: 4012
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
#define N 100009
#define LL long long
int head[N], tot = 0;
long long input[N];
int main() {
	std::ios::sync_with_stdio(0); std::cin.tie(0);
	int n;
	double a = 0, b = 1;
	cin >> n;
	long long c;
	input[0] = 1;
	for (int i = 1;i <= n;i++) {
		cin >> input[i];
		a += log10(input[i]);
		//a *= c;
		//if (a > 1000000000000000000) {
		//
		//	cout << -1;
		//	return 0;
		//}
	}
	//cout << (long long)a;
	if (a >= 18) {
		for (int i = 1;i <= n;i++)
			input[i] *= input[i - 1];
		if (input[n] == 1000000000000000000)
			cout << input[n];
		else
			cout << -1;
	}
	else {
		for (int i = 1;i <= n;i++)
			input[i] *= input[i - 1];
		cout << input[n];
	}
	return 0;
}

Measured memory_bytes: 4324
#include<stdio.h>
int main()
{
	int n, a, b;
	scanf("%d%d%d", &n, &a, &b);
	int r = 0;
	for (int i = 1; i <= n; i++)
	{
		int c = 0, t = i;
		for (int j = 0; j < 5; j++)c += t % 10, t /= 10;
		if (a <= c&&c <= b)r += i;
	}
	printf("%d\n", r);
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;

int main(){
    string s;
    cin>>s;
    int n=s.size();
    stack<string>st;
    rep(i,n){
        if(!i)st.push(string{s[0]});
        else {
            if(st.top()!=string{s[i]}){
                st.push(string{s[i]});
            }
            else {
                if(i<n-1)st.push(string{s[i]}+string{s[i+1]});
                ++i;
            }
        }
    }
    cout<<st.size()<<endl;
    return 0;
}


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

using namespace std;

#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 itn int

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


int main()
{
  int x, y;
  cin >> x >> y;
  if(x < y) cout << min(y-x, abs(y+x)+1) << endl;
  else cout << min(1+x-y, abs(x+y))+1 << endl;
}

Measured memory_bytes: 256
/* بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ */
//codeforces
#include <bits/stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FASTIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define mp make_pair
#define pb push_back
#define sz(v) ((int)v.size())
#define all(v) v.begin(), v.end()
void parseArray(ll* A,ll n){ for ( ll K = 0; K < n; K++){ cin >> A[K]; } }
ll modInverse(ll a, ll b){ return 1<a ? b - modInverse(b%a, a)*b/a : 1; }
ll gcd(ll a, ll b){ return b?gcd(b, a % b):a; }
ll lcm(ll a, ll b){ return (a*b)/gcd(a, b); }
ld dist(ld x, ld y, ld a, ld b){ return sqrt((x-a)*(x-a) + (y-b)*(y-b)); }
void debug(ll* a, ll n) { for ( ll k = 0; k < n; k++ ){ cerr << a[k] << " ";} cout << "\n"; }
#define PI 3.14159265358979323846
#define FF first
#define SS second

const ll mod = 998244353;
int main(){
  FASTIO;
  ll n, m; cin >> n >> m;
  pair<ll, ll> seg[m];
  for ( int k = 0; k < m; k++ )
    cin >> seg[k].FF >> seg[k].SS;
  ll dp[n + 1];
  dp[1] = 1; dp[0] = 0;
  for ( ll k = 2; k <= n; k++ ){
    ll tmp = 0;
    for ( ll j = 0; j < m; j++ ){
      if (seg[j].FF >= k)
        continue;
      ll l = seg[j].FF, r = min(seg[j].SS, k - 1);
      tmp += (dp[k - l] - dp[k - r - 1] + mod) % mod;
      tmp %= mod;
    }
    dp[k] = (tmp + dp[k - 1]) % mod;
  }
  cout << (dp[n] - dp[n - 1] + mod) % mod << endl;
  return 0;
}

Measured memory_bytes: 5212
fn get_line() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line
}

fn print_output(a: i32, b: i32, op: &str) {
    match op {
        "+" => println!("{}", a + b),
        "-" => println!("{}", a - b),
        "*" => println!("{}", a * b),
        "/" => println!("{}", a / b),
        _ => println!("")
    }
}

fn main() {
    loop {
        let line = get_line();
        let mut s = line.trim().split_whitespace();
        let a: i32 = s.next().unwrap().parse().unwrap();
        let op = s.next().unwrap();
        let b: i32 = s.next().unwrap().parse().unwrap();
        if op == "?" {
            break;
        }
        print_output(a, b, op);
    }
}



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

int main() {
  int n;
  cin >> n;
  vector<int> t(110000, 0);
  vector<int> x(110000, 0);
  vector<int> y(110000, 0);
  for(int i = 0; i < n; i++){
    cin >> t.at(i+1) >> x.at(i+1) >> y.at(i+1);
  }
  
  bool can = true;
  for(int i = 0; i < n; i++){
    int dt = t.at(i+1) - t.at(i);
    int dist = abs(x.at(i+1) - x.at(i)) + abs(y.at(i+1) - y.at(i));
    if(dt < dist) can = false;
    if(dist % 2 != dt % 2) can = false;
  }
  
  if(can) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long int;
using ull = unsigned long long int;
using P = pair<int, int>;
using P3 = pair<int,P>;
using PP = pair<P ,P>;
constexpr ll MOD = ll(1e9+7);
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(1e6) + 5;
constexpr double EPS = 1e-8;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()

int n;
string s;

int solve(int a, int b){
    int dp[8][2][2][2]{}; // 桁、未満、先頭、末尾
    dp[0][0][0][0] = 1;
    for(int i=0;i<int(s.size());i++){
        int D = int(s[i]-'0');
        for(int j=0;j<2;j++){
            for(int k=0;k<2;k++){
                for(int l=0;l<2;l++){
                    for(int d=0;d<=(j?9:D);d++){
                        if(k==0 && d!=a && d!=0) continue;
                        dp[i+1][j||(d<D)][k||(d==a)][d==b] += dp[i][j][k][l];
                    }
                }
            }
        }
    }
    int res = 0;

    res += dp[int(s.size())][0][1][1];
    res += dp[int(s.size())][1][1][1];

    return res;
}

int main(){
    cin >> n;
    s = to_string(n);
    int ans = 0;
    for(int i=1;i<=n;i++){
        int a, b;
        b = i%10;
        a = i;
        while(a > 9) a /= 10;
        if(a==0 || b==0) continue;
        ans += solve(b, a);
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  string S;
  cin >> S;
  bool n = false, s = false, w = false, e = false;
  for(int i = 0 ; i < S.size() ; i++){
    if(S[i] == 'N'){
      n = true;
    }else if(S[i] == 'S'){
      s = true;
    }else if(S[i] == 'W'){
      w = true;
    }else if(S[i] == 'E'){
      e = true;
    }
  }
  if((!(n^s)) && (!(w^e))){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
char s[1006];
int a,b,c,d;
int main(){
    scanf("%s",s);
    for(int i=0;s[i];i++)
    if(s[i]=='W')a=1;
    else if(s[i]=='E')b=1;
    else if(s[i]=='N')c=1;
    else d=1;
    if((a^b)||(c^d))puts("No");
    else puts("Yes");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define X first
#define Y second

using namespace std;
typedef long long llint;

const int maxn = 2e5+10;
const int base = 31337;
const int mod = 1e9+7;
const int inf = 0x3f3f3f3f;
const int logo = 18;
const int off = 1 << logo;
const int treesiz = off << 1;

int n;
vector< pair<int, int> > niz[maxn];

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		int x;
		scanf("%d", &x);
		
		for (int j = 0; j < x; j++) {
			int a, b;
			scanf("%d%d", &a, &b); a--;
			niz[i].push_back(make_pair(a, b));
		}
	}
	
	int sol = 0;
	int lim = (1 << n);
	for (int mask = 0; mask < lim; mask++) {
		bool flag = true;
		for (int i = 0; i < n; i++) {
			if (mask & (1 << i)) {
				for (int j = 0; j < niz[i].size(); j++) {
					int tren = niz[i][j].first;
					int pc = niz[i][j].second;
					
					if ((!!(mask & (1 << tren))) != pc) flag = false;
				}
			}
		}
		
		if (flag) sol = max(sol, __builtin_popcount(mask));
	}
	printf("%d", sol);
	return 0;
}



Measured memory_bytes: 8484
#include "bits/stdc++.h"
using namespace std;

typedef long long int ll;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(v,a,b) v.begin(a),v.end(b)
#define in cin>>
#define out cout<<
#define endl <<endl
#define INF 100000000000

int main()
{
	int x, y;
	in x >> y;
	int ans = 0;
	switch (x)
	{
	case 1:
		ans += 300000;
		break;
	case 2:
		ans += 200000;
		break;
	case 3:
		ans += 100000;
		break;
	default:
		break;
	}
	switch (y)
	{
	case 1:
		ans += 300000;
		break;
	case 2:
		ans += 200000;
		break;
	case 3:
		ans += 100000;
		break;
	default:
		break;
	}
	if (x == 1 && y == 1)
	{
		ans += 400000;
	}
	out ans endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;

using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  int counter = 0;
  rep(i, n) {
    int h;
    cin >> h;
    if (h >= k) {
      counter++;
    }
  }
  cout << counter << endl;
}


Measured memory_bytes: 256
//
//  main.cpp
//

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

using namespace std;

using ll = int64_t;
using ull = uint64_t;
constexpr ll LL_MAX = numeric_limits<ll>::max();
constexpr ull ULL_MAX = numeric_limits<ull>::max();

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

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrep(i, a, b) for (ll i = (a)-1; i >= (b); i--)

ll N, X, Y;

ll dist(ll i, ll j) {
    ll ans = numeric_limits<ll>::max();
    ans = min(ans, abs(j-i));
    ans = min(ans, abs(X-i)+abs(Y-j)+1);
    ans = min(ans, abs(Y-i)+abs(X-j)+1);
    return ans;
}

int main() {
    cin >> N >> X >> Y;
    X--;
    Y--;
    unordered_map<ll, ll> dist_cnt;
    rep(i,0,N) {
        rep(j,i+1,N) {
            dist_cnt[dist(i,j)]++;
        }
    }
    rep(k,1,N) {
        cout << dist_cnt[k] << endl;
    }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define SZ(i) int(i.size())
#ifdef tmd
#define IOS()
#define debug(...) fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);_do(__VA_ARGS__);
template<typename T> void _do(T &&x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T &&x, S &&...y){cerr<<x<<", ";_do(y...);}
#else
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(...)
#endif

const int MAXN = 51;
const ll MOD = 1000000007;

int n, m, bridge_cnt;
vector<int> edge[MAXN];

int dfn[MAXN], low[MAXN], tme;
bool vis[MAXN];

void dfs (int nd, int par) {
    dfn[nd] = low[nd] = ++tme;
    vis[nd] = true;
    debug(nd);

    for (auto v : edge[nd]) {
        if (v != par) {
            if (!vis[v]) {
                dfs(v, nd);
                low[nd] = min(low[nd], low[v]);
                if (low[v] >= dfn[v]) {
                    bridge_cnt++;
                }
            } else if (dfn[v] < dfn[nd]){
                debug(v, nd);
                low[nd] = min(low[nd], dfn[v]);
            }
        }
    }

    debug(low[nd], dfn[nd], nd);
}
/*********************GoodLuck***********************/
int main () {
    IOS();

    cin >> n >> m;
    REP (i, m) {
        int u, v;
        cin >> u >> v;
        edge[u].emplace_back(v);
        edge[v].emplace_back(u);
    }

    dfs(1, 1);

    cout << bridge_cnt << endl;
}


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

int main() {
  int n;
  long long sum;
  cin >> n;
  sum = 1;
  vector<long long> vec(n);
  for(int i=0;i<n;i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  for(int i=0;i<n;i++){
    if(vec.at(i) > 1000000000000000000/sum){
      cout << -1;
      break;
    }
    else
      sum *= vec.at(i);
      if(sum == 0){
      cout << 0;
      break;
    }

    if(i == n-1)
    cout << sum << endl;
  }
}


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

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

    int sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> a;
        sum += a;
    }

    if (sum%2==0) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<math.h>

int main(){
	int i;
	int h,e,n;
	
	scanf("%d", &i);
	
	for( ; i != 0; i--){
		scanf("%d%d%d", &h, &e, &n);
		
		h = pow(h,2);
		e = pow(e,2);
		n = pow(n,2);
		
		if(h > e){
			if(h > n){
				//h max
				if(h == (e+n)){
					printf("YES\n");
					continue;
				}
			}else{
				//n max
				if(n == (h+e)){
					printf("YES\n");
					continue;
				}
			}
		}else{
			if(e > n){
				//e max
				if(e == (h+n)){
					printf("YES\n");
					continue;
				}
			}else{
				//n max
				if(n == (h+e)){
					printf("YES\n");
					continue;
				}
			}
		}
		
		printf("NO\n");
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
ll a[200010];
int main() {
    ll sum=0,n;
    cin>>n;
    for(ll i=1;i<=n;i++)    cin>>a[i],sum^=a[i];
    for(ll i=1;i<=n;i++)    printf("%d ",sum^a[i]);
    return 0;
}


Measured memory_bytes: 4340
#include <stdio.h>
#include <string.h>

int main(){  
	int angka; 
    char x[255];
    scanf("%d", &angka);
    scanf("%s",x);
    int a= strlen(x);	
	if(a > angka){
        for(int i=0;i<angka;i++){
            printf("%c",x[i]);
        }
        printf("...");
    }
    else if(a == angka|| a < angka){
        printf("%s",x);
    }
    return 0;
}

 

Measured memory_bytes: 3224
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <cstdio>
#include <cmath>
using namespace std;


int main(){
    long long int N;
    cin >> N;
    if(N % 2 != 0){
        cout << 0 << endl;
    } else {
        N /= 2;
        long long int answer = 0;
        while (N > 0) {
            N /= 5;
            answer += N;
        }
        cout << answer << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_set>
#include <bitset>
#include <time.h>
#include <limits.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define Fi first
#define Se second
#define pb push_back
#define szz(x) (int)x.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
typedef tuple<int, int, int> t3;

int n;
vector <int> E[200020];
int d[200020];

int far(int x) {
	vector <int> q; q.pb(x);
	memset(d, -1, sizeof d);
	d[x] = 0;
	rep(i, szz(q)) {
		int t = q[i];
		for(int e : E[t]) if(d[e] == -1) {
			d[e] = d[t] + 1;
			q.pb(e);
		}
	}
	return q.back();
}

int main() {
	scanf("%d", &n);
	rep(i, n-1) {
		int x, y; scanf("%d%d", &x, &y);
		E[x].pb(y);
		E[y].pb(x);
	}
	int a = far(1);
	int b = far(a);
	int L = d[b] + 1;
	if(L % 3 != 2) puts("First");
	else puts("Second");
	return 0;
}


Measured memory_bytes: 14564
n = int(input())
f = [list(map(int,input().split())) for i in range(n)]
p = [list(map(int,input().split())) for i in range(n)]

res = -float('inf')
for i in range(1,1<<10):
    a = [0]*n
    for j in range(10):
        for m in range(n):
            if i&1 and f[m][j]:
                a[m] += 1
        i >>= 1
    w = 0
    for j in range(n):
        w += p[j][a[j]]
    res = max(res,w)
print(res)


Measured memory_bytes: 3064
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations
import sys
import bisect
import string
sys.setrecursionlimit(10**6)
def SI():
    return input().split()
def MI():
    return map(int,input().split())
def I():
    return int(input())
def LI():
    return [int(i) for i in input().split()]
YN=['Yes','No']
mo=10**9+7

p=I()
a=LI()

mo=float('inf')
mo=p

class polynomial:
    coeff=[]
    def __init__(self,ls):
        self.coeff=[i for i in ls]
        
    def show(self):
        s=''
        f=self.coeff
        n=len(f)
        for i in range(n):
            if f[n-1-i]==0:
                continue
            s+=('+' if f[n-1-i]>=0 else '')+str(f[n-1-i])+('x^'+str(n-1-i) if i!=n-1 else '')
        print(s[1:])

    def value(self,x):
        x_p=1
        rt=0
        for i in self.coeff:#range(len(self.coeff)):
            rt+=i*x_p
            x_p*=x
        return rt
            
    def mod(self):
        self.coeff=[i%mo for i in self.coeff]
        
    def add(self,poly):
        g=poly.coeff
        n=len(self.coeff)
        m=len(g)
        if n>m:
            g+=[0]*(n-m)
        else:
            self.coeff+=[0]*(m-n)
        self.coeff=[i+j for i,j in zip(self.coeff,g)]
        return self
        
    def mult(self,poly):
        if type(poly) in (int,float):
            poly=polynomial([poly])
        f=self.coeff
        g=poly.coeff
        n=len(self.coeff)
        m=len(g)
        h=[0]*(n+m-1)
        for i in range(n):
            for j in range(m):
                h[i+j]+=f[i]*g[j]
                
        self.coeff=h
        return self
        
    def div(self,poly):
        # f=[a0,a1,...,a(n-1)], f(x) = a0 + a1*x + ... + a(n-1)*x^(n-1)
        # g=[b0,b1,...,b(m-1)], g(x) = b0 + b1*x + ... + b(m-1)*x^(m-1)
        f=[i for i in self.coeff]
        g=poly.coeff
        n=len(f)
        m=len(g)
        d=[]
        if g[-1]==0:
            # error
            return None
        if m>n:
            return (0,f)
        for i in range(n-m+1):
            c=div(f[n-1-i],g[m-1])
            d+=[c]
            for j in range(m):
                f[n-1-i-j]-=c*g[m-1-j]
        return (polynomial(d[::-1]),polynomial(f[:n-m+1]))

inv=[0]*p
for i in range(p):
    for j in range(p):
        if i*j%p==1:
            inv[i]=j
            break
def p_inv(x,p):
    #return pow(x,p-2,p)
    return inv[x]
    
def div(a,b):
    #return a/b
    return a*p_inv(b,p)%p

# calc Prod{(x-j)}
L=polynomial([0,1])
for i in range(1,p):
    L.mult(polynomial([-i,1]))
    L.mod()

S=[L.div(polynomial([i,-1]))[0] for i in range(p)]

A=polynomial([0]*p)
for i in range(p):
    if a[i]==1:
        A.add(S[i])
print(*[i%mo for i in A.coeff])




Measured memory_bytes: 131848
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e16
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {

	int h, w;
	ull ans = INF;
	cin >> h >> w;
	ull p1, p2, p3, x, y;

	for (ull i = 1; i < w; i++) {
		p1 = i * h;
		p2 = (w - i)*(h + (h % 2)) / 2;
		p3 = (w - i)*(h - (h % 2)) / 2;
		x = max(p1, max(p2, p3)); y = min(p1, min(p2, p3));
		ans = min(ans, x - y);
		p2 = h * (w - i + ((w - i) % 2)) / 2;
		p3 = h * (w - i - ((w - i) % 2)) / 2;
		x = max(p1, max(p2, p3)); y = min(p1, min(p2, p3));
		ans = min(ans, x - y);
	}

	swap(h, w);

	for (ull i = 1; i < w; i++) {
		p1 = i * h;
		p2 = (w - i)*(h + (h % 2)) / 2;
		p3 = (w - i)*(h - (h % 2)) / 2;
		x = max(p1, max(p2, p3)); y = min(p1, min(p2, p3));
		ans = min(ans, x - y);
		p2 = h * (w - i + ((w - i) % 2)) / 2;
		p3 = h * (w - i - ((w - i) % 2)) / 2;
		x = max(p1, max(p2, p3)); y = min(p1, min(p2, p3));
		ans = min(ans, x - y);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 764
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<iomanip>
#include<cassert>

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

	int k;

	std::cin >> k;

	if (k % 2 != 0){//kが奇数のとき
		std::cout << (k / 2) * (k / 2 + 1) << '\n';
	}
	else{
		std::cout << (k / 2) * (k / 2) << '\n';
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
using namespace std;
int main(void){
    int n,k;
    cin>>n;
   int a[100005];
    for(int i=1;i<=n;i++){
        cin>>k;
        a[k]=i;
    }
    for(int i=1;i<=n;i++){
        if(i!=1)cout<<" ";
        cout<<a[i];
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 1152
#include<set>
#include<map>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<iostream>
#include<queue>
#include<algorithm>
#include<string.h>
#include<math.h>
using namespace std;
typedef long long ll;



int main(){
    ll n,t;
    cin>>n>>t;
    ll tot=0,last=-1;
    ll v;
    cin>>v;
    tot+=t;
    last=t;
    for(int i=1;i<n;i++){
        cin>>v;
        tot+=v+t-max(last,v);
        last=v+t;
    }
    cout<<tot<<endl;
}


Measured memory_bytes: 256
l=int(input())
a=[0 for i in range(l)]
b=[0 for i in range(l)]
for i in range(l):
    a[i],b[i]=list(map(int,input().split(' ')))

la=max(a)
sa=min(a)
sb=min(b)

s=sa-1
m=la-sa+1
l=sb
print(s+m+l)



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

int main()
{
  int X, A, B, C;
  cin >> A >> B >> C >> X;
  int res = 0;
  for (int a = 0; a <= A; ++a) {
    for (int b = 0; b <= B; ++b) {
      for (int c = 0; c <= C; ++c) {
        int sum = 500 * a + 100 * b + 50 * c;
        if (sum == X)
          ++res;
      }
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,i,a;
  scanf("%d",&n);
  int p=0;
  for(i=1;i<=n;i++)
  {
    scanf("%d",&a);
    if(i!=a)
    {
      p++;
    }
  }
  if(p>=3)
  {
    printf("NO");
  }
  else
    printf("YES");
}

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

using namespace std;

uint64_t accum(uint64_t a, int indent = 0) {
  auto tmp = to_string(a);
  uint64_t sum = 0;
  for (int i = 1; i < tmp.size(); ++i) {
    string left(&tmp[0], i);
    string right(&tmp[i], tmp.size() - i);
    // for (int j = 0; j < indent; ++j) cout << " ";
    // cout << left << " + " << right << "\n";
    sum += stoll(left) * pow(2, right.size() - 1);
    sum += accum(stoll(right), indent + 2);
  }
  return sum + a;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  uint64_t s;
  cin >> s;
  cout << accum(s) << "\n";
}


Measured memory_bytes: 256
n = gets.to_i
restaurants = []
n.times do |i|
  city, point = gets.split
  restaurants << [i + 1, city, point.to_i]
end

restaurants.sort{|(i1, c1, p1), (i2, c2, p2)| c1 == c2 ? ((p1 <=> p2) * -1) : (c1 <=> c2)}
           .each{|(i, _, _)| puts i}

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

using namespace std;

int main(){

    int N;
    cin >> N;

    vector<int> B(N);
    vector<int> A(N);

    int i;
    for(i=0; i<N-1; i++) cin >> B.at(i);

    A.at(0) = B.at(0);
    for(i=1; i<N-1; i++){
        A.at(i) = min(B.at(i-1), B.at(i));
    }
    A.at(N-1) = B.at(N-2);

    int ans = accumulate(A.begin(), A.end(), 0);

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 888
import sys

stdin = sys.stdin

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

s = ns()
n = len(s)
if n % 2 == 0:
    s0 = "01" * int(n/2)
else:
    s0 = "01" * int(n/2) + "0"

c0 = 0
c1 = 0
for i in range(n):
    if s[i] == s0[i]:
        c0 += 1
    else:
        c1 += 1

if c0 < c1:
    print(c0)
else:
    print(c1)


Measured memory_bytes: 3188
N = int(input())
flag = 0
for i in range(N):
  if (N % (i+1)) == 0:
    a = i + 1
    b = N /(i+1)
    if a // 10 == 0 and b // 10 == 0:
      print("Yes")
      flag = 1
      break
if flag == 0:
  print("No")

Measured memory_bytes: 3060
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

var (
	readString func() string
	readBytes  func() []byte
	stdout     *bufio.Writer
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), math.MaxInt32)
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		return []byte(f1())
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

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(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

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

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

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

// readString() string
// readInt() int
// readInt64() int64
// readFloat64() float64

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	N := readInt()
	if N%2 == 0 {
		println(0.5)
	} else {
		println(float64((N-1)/2+1) / float64(N))
	}
}

// -----------------------------------------------------------------------------


Measured memory_bytes: 640
# ABC047 B - すぬけ君の塗り絵 2 イージー / Snuke's Coloring 2 (ABC Edit)
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

W,H,N = nl()

ans = 0
x_l,y_u = 0,0
x_r,y_o = 101,101

for i in range(N):
    x,y,a = nl()
    if a==1:
        x_l = max(x_l,x)
    elif a==2:
        x_r = min(x_r,x)
    elif a==3:
        y_u = max(y_u,y)
    elif a==4:
        y_o = min(y_o,y)

if x_r==101:
    x_r = W
if y_o == 101:
    y_o = H

if x_r > x_l and y_o > y_u:
    ans = (x_r-x_l)*(y_o-y_u)
else:
    ans = 0

print(ans)

Measured memory_bytes: 3064