akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;


//TEMPLATE
#define pb                push_back
#define mp                make_pair
#define ll                long long
#define ld                long double
#define pii               pair <ll, ll>
#define piii              pair <ll, pii>
#define F                 first
#define S                 second

#define newline           printf("\n")
#define minusone          printf("-1\n")
#define zeroo             printf("0\n")
#define scl1(a)           scanf("%lld", &a)
#define scl2(a, b)        scanf("%lld %lld", &a, &b)
#define scl3(a, b, c)     scanf("%lld %lld %lld", &a, &b, &c)
#define prl1(a)           printf("%lld\n", a)
#define prl2(a, b)        printf("%lld %lld\n", a, b)
#define ssl1(s)           scanf(" %[^\n]", s)
#define scd1(a)           scanf("%lf", &a)
#define scd2(a, b)        scanf("%lf %lf", &a, &b)
#define prd(a)            printf("%lf\n", a)
#define prld(a)           printf("%Lf\n", a)
#define prcase(cs)        printf("Case %lld: ", cs)
#define cin1(a)           cin >> a
#define cin2(a, b)        cin >> a >> b
#define cin3(a, b, c)     cin >> a >> b >> c
#define cin4(a, b, c, d)  cin >> a >> b >> c >> d
#define cot1(a)           cout << a << "\n"
#define cot2(a, b)        cout << a << " " << b << "\n"
#define cot3(a, b, c)     cout << a << " " << b << " " << c << "\n"
#define cot4(a, b, c, d)  cout << a << " " << b << " " << c << " " << d << "\n"
#define cotline           cout << "\n"
#define cotminus          cout << "-1\n"
#define cot0              cout << "0\n"
#define cotyes            cout << "YES\n"
#define cotno             cout << "NO\n"
#define cotcase(cs)       cout << "Case " << cs << ": "

#define reversed(s)       reverse(s.begin(), s.end())
#define asort(s)          sort(s.begin(), s.end())
#define dsort(s)          sort(s.rbegin(), s.rend())
#define all(s)            s.begin(), s.end()
#define uniq(s)           s.resize(distance(s.begin(),unique(s.begin(), s.end())))
#define found(s, x)       (s.find(x) != s.end())

#define for0(i, n)        for (i = 0; i < n; i++)
#define for1(i, n)        for (i = 1; i <= n; i++)
#define fora(i, a, b)     for (i = a; i <= b; i++)
#define forb(i, b, a)     for (i = b; i >= a; i--)
#define fori(it, s)       for(auto it = s.begin(); it != s.end(); it++)

#define FR                ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ms(a, x)          memset(a, x, sizeof a)
#define bitcount(n)       __builtin_popcountll(n)

//#define pi              3.1415926536
#define pi                acos(-1)

const ll INF = LLONG_MAX;
const ll SZ = 1e6+5;
const ll mod = 1e9+7;


ll n;
ll m[SZ];
//ll b[SZ];

//map <ll, bool> m;

int main() {
    ll cs = 0, tc = 1, x, y, z, i, j, k, g, p, q, ans = 0, sum = 0, c = 0, t = 0;
//    ll a, b, d;
    string s, s1, s2;

    cin1(k);

    i = 0;
    while(1) {
        i++;
        c = (c *10) + 7;
        c %= k;
        if(c == 0) {
            cot1(i);
            return 0;
        }
        if(m[c]) {
            cotminus;
            return 0;
        }
        m[c] = 1;
    }

    return 0;
}



Measured memory_bytes: 11360
#include <bits/stdc++.h>
using namespace std;
int main()
  {      int N,L;
                  cin>>N>>L;
                  int t=L*N+N*(N+1)/2-N;
                if((L<=0 && L+N-1>=0) || (L>=0 && L+N-1<=0))
                {
                    cout<<t;
                }
                else if(L>=0)
                {
                    cout<<t-L;
                }
                else
                {
                    cout<<t-L-N+1;
                }



     return 0;
  }

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>


using namespace std;

using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)




int main() {
	int n;
	cin >> n;
	vector<vector<int> > vss(n);
	map<pair<int, int> , int> edge;

	rep (i, n - 1) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		vss[a].push_back(b);
		vss[b].push_back(a);
		edge[make_pair(a,b)] = i;
		edge[make_pair(b,a)] = i;
	}
	int sx = -1;
	rep (i, n) {
		if (vss[i].size() == 1) {
			sx = i;
			break;
		}
	}

	//cout << "sx:" << sx << endl;
	
	vector<int> ans(n - 1, -1);
	queue<pair<int, int> > que;
	int k = -1;


	que.push(make_pair(sx, -1));
	while(!que.empty()) {
		int cur_v = que.front().first;
		int prev_color = que.front().second;
		que.pop();
		int color = 0;


		for(int v : vss[cur_v]) {
			//cout << "cur_v:" << cur_v << " v:" << v << endl;
			auto e = make_pair(cur_v, v);

			if (ans[edge[e]] >= 0) {
				//cout << "continue" << endl;
				continue;
			} 

			color++;
			if (color == prev_color) {
				color++;
			}
			ans[edge[e]] = color;
			que.push(make_pair(v, color));
			if (k < color) {
				k = color;
			}
			//cout << "color:" << color << endl;

		}
	}
	cout << k << endl;
	rep(i, n - 1) {
		cout << ans[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 15872
// warm heart, wagging tail,and a smile just for you!
//
//                            ▒█████▒▒
//                             ██████████▒
//                             ▒████████████▒
//                            ██████████████████
//                           ████████████████████▒
//                          ▒██████████████████████▒
//                          ▒███████████████████████
//                      ▒████▒▒▒▒▒▒█████████████████▒
//                    ███▒▒▒▒▒▒██████████████████████▒▒▒
//                  ▒██▒▒███████████████████████▒▒▒▒▒██████
//                 ▒█████████████████████████▒▒▒▒▒▒█████████▒
//                 ▒█████████████████████▒▒▒▒▒▒██████████████
//                  ▒████         ████▒▒▒▒▒████         ████▒
//              ▒█████▒    ████    ▒▒▒▒███████    ████    ██████▒
//            ▒██▒▒▒▒▒    ██████    █████████    ██████    ██▒▒▒██▒
//           █████████   ████████   █████████   ████████   ▒▒▒▒█████
//          ▒█████████    ██████    ████████▒    ██████    █████████
//          ▒██████████    ████    █████▒▒▒▒▒▒    ████    ██████████
//           ████████████        ▒▒▒▒▒▒▒████████        ███████████▒
//       ▒██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████████▒
//     ███▒▒▒▒▒▒▒▒▒▒▒▒█████████████████████████████████████████▒▒████████▒
//   ▒▒▒▒▒▒▒▒▒██████████████                         ███████▒▒▒▒███████████
//   █████████████████████████                     ███████▒▒▒██████████████▒
//   █████████████████████████████             ███████▒▒▒██████████████████▒
//   ██████████████████████████████████████████████████████████████████████
//    ██████████████████████████████████████████████████████████████████▒
//      ▒█████████████████▒▒▒▒▒▒▒██████████████████████████████████▒▒▒
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

mat ans(550,vec(550,-1));

void solve(int l, int r, int lev){
  int mid = (l+r)/2;
  //cout << l SP r << endl;
  if(r-l <= 1) return;
  FOR(i,l,mid){
    REP(j,r-mid) ans[i][j+mid] = ans[j+mid][i] = lev;
  }
  solve(l,mid,lev+1);
  solve(mid,r,lev+1);
  return;
}

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

  int n;
  cin >> n;

  solve(1,n+1,1);

  REP(i,n-1){
    FOR(j,i+1,n) cout << ans[i+1][j+1] << " ";
    cout << endl;
  }

  // REP(i,10){
  // REP(j,10){ cout << ans[i][j] <<" ";} cout << endl;}

  return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REV(c) reverse((c).begin(),(c).end())

using namespace std;

// 最大公約数
int64_t gcd(int64_t a, int64_t b) {
  return b != 0 ? gcd(b, a % b) : a;
}

// 最小公倍数
int64_t lcm(int64_t a, int64_t b) {
  return a * b / gcd(a, b);
}

int ctoi(char c){
  return c - '0';
}

struct UnionFind {
  vector< int > data;
 
  UnionFind(int sz) {
    data.assign(sz, -1);
  }
 
  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }
 
  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }
 
  int size(int k) {
    return (-data[find(k)]);
  }
};

int main(){
  string s;
  cin >> s;
  int a = ctoi(s.at(0));
  int b = ctoi(s.at(1));
  int c = ctoi(s.at(2));
  int d = ctoi(s.at(3));
  if (a + b + c + d == 7){
    cout << a << "+" << b << "+" << c << "+" << d << "=7" << endl;
    return 0;
  }
  if (a + b + c - d == 7){
    cout << a << "+" << b << "+" << c << "-" << d << "=7" << endl;
    return 0;
  }
  if (a + b - c + d == 7){
    cout << a << "+" << b << "-" << c << "+" << d << "=7" << endl;
    return 0;
  }
  if (a - b + c + d == 7){
    cout << a << "-" << b << "+" << c << "+" << d << "=7" << endl;
    return 0;
  }
  if (a + b - c - d == 7){
    cout << a << "+" << b << "-" << c << "-" << d << "=7" << endl;
    return 0;
  }
  if (a - b - c + d == 7){
    cout << a << "-" << b << "-" << c << "+" << d << "=7" << endl;
    return 0;
  }
  if (a - b + c - d == 7){
    cout << a << "-" << b << "+" << c << "-" << d << "=7" << endl;
    return 0;
  }
  if (a - b - c - d == 7){
    cout << a << "-" << b << "-" << c << "-" << d << "=7" << endl;
    return 0;
  }
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, int> pli;
typedef complex<double> xy_t;
typedef vector<lint> poly;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}

const lint mod = 1e9+7;
const lint INF = mod*mod;
const int MAX =200010;

int n;
lint a[MAX], b[MAX];

int main(){
    scanf("%d", &n);
    rep(i, n) scanf("%lld", &a[i]);
    rep(i, n) scanf("%lld", &b[i]);

    priority_queue<pli> que;
    rep(i, n) que.emplace(b[i], i);
    lint ans=0;
    while(!que.empty()){
        pli p=que.top(); que.pop();
        lint val=p.fi;
        int idx=p.se;
        int pre=(idx+n-1)%n, nxt=(idx+1)%n;
        if(val==a[idx] || val-(b[pre]+b[nxt])<a[idx]) continue;
        lint t=(val-a[idx])/(b[pre]+b[nxt]);
        b[idx]-=t*(b[pre]+b[nxt]);
        que.emplace(b[idx], idx);
        ans+=t;
    }
    rep(i, n)if(a[i]!=b[i]){
        printf("-1\n");
        return 0;
    }
    printf("%lld\n", ans);
}

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

int main(){

long sum_A=0,sum_B=0;
int N;
scanf("%d",&N);
int A[N];
for (int  i = 0; i < N; i++)
{
  scanf("%d",&A[i]);
}

int i=0,j=N-1;
while (i<=j)
{
  if (sum_A>=sum_B){
    sum_B += A[j--];
  }else{
    sum_A += A[i++];
  }
}

printf("%d",abs(sum_A-sum_B));

return 0;
}

Measured memory_bytes: 2512
using System;   	
class Program
    {
        static void Main(string[] args)
        {
            String[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);
            int k = int.Parse(input[2]);

            for (int i = a; i <= b; i++)
            {
                if (i <= a + k - 1)
                {
                    Console.WriteLine(i);
                }
                else if (i >= b - k + 1)
                {
                    Console.WriteLine(i);
                }
            }
            Console.ReadLine();
        }
    }

Measured memory_bytes: 13140
#include<iostream>
#include<vector>
#include<list>
#include<string>


using namespace std;


bool solve()
{
	int n; cin >> n;
	vector<string> w(n);

	if (n == 0)return false;

	for (int i = 0; i < n; ++i)
	{
		cin >> w[i];
	}

	for (int i = 0; i < w.size(); ++i)
	{
		list<int> mojisu{ 5,7,5,7,7 };
		for (int j = i; j < w.size(); ++j)
		{
			mojisu.front() -= (int)w[j].size();

			if (mojisu.front() == 0)
			{
				mojisu.pop_front();
				if (mojisu.empty())
				{
					cout << i+1 << endl;
					return true;
				}
			}
			else if (mojisu.front() < 0)
			{
				break;
			}

		}
	}
}


int main()
{
	while (solve())
	{
		
	}
}


Measured memory_bytes: 3168
#include <iostream>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <complex>

using namespace std;
typedef long long ll;


typedef complex<double> xy_t;
double dot_product(xy_t a, xy_t b) { return (conj(a)*b).real(); }
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }

typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする

vector<int> G[100005];
std::vector<P> tree[100010];

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

#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define re(i,a,b) for(i=a;i<=b;i++)
#define pb push_back
#define lb lower_bound
#define ub upper_bound

ll i,j,k,ii,jj;
ll n,m,sum,num;
ll ans=0;
ll a,b,c,d,e,h,w;

ll x[500005],y[500005],z[500005];
string s,t;
bool flag;
bool check[100005];


int main(){
    cin>>s>>t;
    s = s+s;
    n=t.length();
    for(i=0;i<n;i++){
        if(s.substr(i,n)==t){
            flag=true;
        }
    }
    if(flag){
        p("Yes");
    }else{
        p("No");
    }
    
    return 0;
}


Measured memory_bytes: 6528
using System;
using System.Collections.Generic;
using System.Linq;
class Program{
	const int mod=1000000007;
	const long o=1;
	static List<int>[] li;
	static int[] s;
	static int[][] h;
	static int ans=0;
	static void Main(){
		Sc sc=new Sc();
		s=sc.Ia;
		li=new List<int>[s[0]+1];
		int[][] q=new int[s[0]+1][];
		for(int i=1;i<=s[0];i++){li[i]=new List<int>();}
		for(int i=1;i<s[0];i++){
			q[i]=sc.Ia;
			li[q[i][0]].Add(q[i][1]);
			li[q[i][1]].Add(q[i][0]);
		}
		if(s[1]%2==0){
			for(int i=1;i<=s[0];i++){ans=Math.Max(ans,Fu1(i,0,0));}
		}
		else if(s[1]==1){ans=2;}
		else{
			h=new int[s[0]+1][];
			for(int i=1;i<=s[0];i++){h[i]=new int[li[i].Count];}
			for(int i=1;i<=s[0];i++){Fu2(i);}
			for(int i=1;i<s[0];i++){
				int p=2;
				for(int j=0;j<h[q[i][0]].Length;j++){
					if(li[q[i][0]][j]!=q[i][1]){p+=h[q[i][0]][j];}
				}
				for(int j=0;j<h[q[i][1]].Length;j++){
					if(li[q[i][1]][j]!=q[i][0]){p+=h[q[i][1]][j];}
				}
				ans=Math.Max(ans,p);
			}
		}
		Console.WriteLine("{0}",s[0]-ans);
	}
	static int Fu1(int a,int b,int c){
		int p=0;
		if(c<s[1]/2){
			for(int i=0;i<li[a].Count;i++){
				if(li[a][i]!=b){p+=Fu1(li[a][i],a,c+1);}
			}
		}
		return p+1;
	}
	static void Fu2(int a){
		for(int i=0;i<li[a].Count;i++){h[a][i]+=Fu1(li[a][i],a,1);}
	}
}

class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
}

Measured memory_bytes: 13652
import math
results = []
while True:
    inputs = input().split()
    a = int(inputs[0])
    ope = inputs[1]
    b = int(inputs[2])
    result = None
    if ope == '?':
        break
    elif ope == '+':
        result = a + b
    elif ope == '-':
        result = a - b
    elif ope == '*':
        result = a * b
    elif ope == '/':
        result = math.floor(a / b)
    results.append(result)

for result in results:
    print(result)


Measured memory_bytes: 5668
#include<stdio.h>
#include<iostream>
using std::cin;

char op;
int a,b;

int main(void){
    scanf("%d",&a);
    cin>>op;
    scanf("%d",&b);
    if(op=='+')
		printf("%d\n",a+b);
    else
		printf("%d\n",a-b);
    return 0;
}

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

#define ll long long
#define ar array

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

	string s;
	int q;
	cin >> s >> q;
	bool st=0;
	vector<char> v[2];
	while(q--) {
		int qt;
		cin >> qt;
		if(qt==1) {
			st=!st;
		} else {
			int f;
			char c;
			cin >> f >> c, --f;
			v[f^st].push_back(c);
		}
	}
	string t;
	for(int i=(int)v[0].size()-1; ~i; --i)
		t+=v[0][i];
	t+=s;
	for(char c : v[1])
		t+=c;
	if(st)
		reverse(t.begin(), t.end());
	cout << t;
}

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

using namespace std;
typedef long long ll;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)

#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define INF ((1LL<<62)-(1LL<<31)) /*オーバーフローしない程度に大きい数*/
#define MOD 1000000007

int main(){
// ここに処理を記述
    int N;
    cin >> N;

    vector<int> h;
    int temp = 0;
    h.push_back(0); // 1-indexed
    for(int i=0; i<N; i++){
        cin >> temp;
        h.push_back(temp);
    }

    vector<int> dp(N+1, 0);
    FOR(i,2,N+1){
        if(i-2 >= 1){
            dp[i] = min(dp[i-1]+abs(h[i-1]-h[i]), dp[i-2]+abs(h[i-2]-h[i]));
        }
        else{
            dp[i] = dp[i-1]+abs(h[i-1]-h[i]);
        }
    }

    int ans = dp[N];

    cout << ans << "\n";

return 0;
}

Measured memory_bytes: 1144
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
typedef int ll;
using namespace __gnu_pbds;
using namespace std;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define len(v) ((int)v.size())
#define all(v) v.begin(), v.end()
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define orz ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);    
#define inp freopen("input.txt","r",stdin);freopen("out.txt","w",stdout); 
ll mod1=1e9+7;
void io(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //cout.tie(NULL);    
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif
}

int main() {
    orz;
    //inp;
    int n,i,j,k;
    cin>>n;
     map<string,int> mp;
     string s;
     uint64_t count = 0;
     
     for(int i=0;i<n;i++){
       cin >> s;
       sort(s.begin(),s.end());
       count += mp[s];
       mp[s]++;
      }
     
    cout << count;

}




Measured memory_bytes: 11264
def main():
    n=int(input())
    s=input()
    m=0
    for i in range(1,n):
        cnt_m=0
        cnt=0
        for j in range(i,n):
            if s[j-i]==s[j]:
                cnt=min(cnt+1,i)
            else:
                cnt_m=max(cnt,cnt_m)
                cnt=0
        m=max(cnt,cnt_m,m)
    print(m)

if __name__ == '__main__':
    main()

Measured memory_bytes: 43376
#include<bits/stdc++.h>
using namespace std;
#define fast {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
typedef long long int ll;
typedef string S;
#define M 1e18
#define AS 250005
#define sp cout<<' '
#define nw cout<<endl
#define rt return
#define __ template<typename T, typename... Types>
void in() {rt;} __ void in(T &a, Types&... b){cin>>(a); in(b...);}
void o() {rt;}  __ void o(T a, Types... b){cout<<(a);sp; o(b...);}
#define fr(i,a,n) for(ll i=a;i<=n;i++)
#define frm(i,a,n) for(ll i=n;i>=a;i--)
#define P pair<ll,ll>
#define vc vector<ll>
#define pb push_back
#define MP map<ll,ll>
bool sortin(const pair<ll,ll> &e,const pair<ll,ll> &f){return (e.first<f.first);}
bool POT(ll x){return x && (!(x&(x-1)));}
ll i,j,k,l,m,n,p,q,r,a,b,c,x,y,z,ts,mn=1e18,mod=1e9+7;
ll ar[AS],br[AS],xr[AS],tem[AS];
int main()
{
    fast;
    S s;
    in(s);
    l=s.size();
    if(s[l-1]=='s')s+="es";
    else s+='s';
    o(s);
}



Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};


int main(){
  int a,b;
  cin>>a>>b;
  int ans;
  if(a>=13){
    ans = b;
  }else if(a>=6){
    ans = b/2;
  }else{
    ans = 0;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
/*
        karmany evadhikaras te
        ma phalesu kadacana 
        ma karma-phala-hetur bhur
        ma re sango'stv akarmani (B.G.-2.47)
 
Translation:
        Lord Krsna to Arjuna.
You have a right to perform your prescribed duty, 
but you are not entitled to the fruits of action. 
Never consider yourself the cause of the results of your activities, 
and never be attached to not doing your duty.    
*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
const int N = 1000005;
#define ld long double
#define PI 3.14159265358979323846
const int INF = 1e9+7;

void flash()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(12);
}

//3. Structure or classes
//3. Ends here

//1. Data structures declaration here
//1. Ends here


//2. Extra Functions here
//2. Ends here


void solve();
int32_t main()
{
    flash();
    int t;
    t = 1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

void solve()
{
    int n;
    cin>>n;
    bool rep[N]={0};
    bool vis[N]={0};

    set<int>st;

    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        if(st.find(x)==st.end())st.insert(x);
        else rep[x]=1;
    }

    int ans=0;

    for(auto i:st){
        if(vis[i]==1)continue;
        for(int j=2*i;j<N;j+=i){
            vis[j]=1;
        }
        ans += (!rep[i] && !vis[i]);
    }

    cout<<ans;


    return;
}

Measured memory_bytes: 14844
#include <iostream>
#include <list>
#include <stack>

using namespace std;

int main() {
	list<int> stat;

	for (int i = 0, in; cin >> in; i++, stat.push_back(in));

	stack<int> stacK;
	for (list<int>::iterator it = stat.begin(); it != stat.end(); it++, it = stat.begin()) {
		if (*it == 0) {
			cout << stacK.top() << endl;
			stacK.pop();
		} else
			stacK.push(*it);
		stat.pop_front();
	}
}

Measured memory_bytes: 1200
n, m = map(int, input().split())
li = []
for i in range(n):
    l = list(map(int, input().split()))
    for j in l[1:]:
        li.append(j)
ans = 0
for i in range(31):
    if li.count(i) == n:
        ans += 1
print(ans)

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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

pll P[105];
//! [i番目までの問題を][j問解いた時の]=最大点数
ll dp[15][1005];

int main()
{
    ll D, G;
    cin >> D >> G;
    REP(i, D)
    {
        cin >> P[i].first >> P[i].second;
    }
    dp[0][0] = 0;
    ll sum = 0;
    REP(i, D)
    {
        sum += P[i].first;
        REP(j, sum + 1)
        {
            ll max = 0;
            REP(k, P[i].first + 1)
            {
                if (j - k < 0)
                    break;
                ll s = dp[i][j - k] + 100 * (i + 1) * k;
                if (k == P[i].first)
                    s += P[i].second;
                max = std::max(s, max);
            }
            dp[i + 1][j] = max;
        }
    }

    REP(i, sum + 1)
    {
        if (dp[D][i] >= G)
        {
            cout << i << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100100;
const int MOD = 1e9+7;
const int ABC = 3;

template<int mod> struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) { if((x += p.x) >= mod) x -= mod; return *this; }
    ModInt &operator-=(const ModInt &p) { if((x += mod-p.x) >= mod) x -= mod; return *this; }
    ModInt &operator*=(const ModInt &p) { x = (int)(1LL*x*p.x%mod); return *this; }
    ModInt &operator/=(const ModInt &p) { *this *= p.inverse(); return *this; }
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const{
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0) { t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); }
        return ModInt(u);
    }
    ModInt pow(int e){
        long long a = 1, p = x;
        while(e > 0) {
            if(e%2 == 0) {p = (p*p) % mod; e /= 2;}
            else {a = (a*p) % mod; e--;}
        }
        return ModInt(a);
    }
    friend ostream &operator<<(ostream &os, const ModInt<mod> &p) {
        return os << p.x;
    }
    friend istream &operator>>(istream &is, ModInt<mod> &a) {
        long long x;
        is >> x;
        a = ModInt<mod>(x);
        return (is);
    }
};

int main() {
    string s;
    cin >> s;
    int n = s.length();
    ModInt<MOD> dp[MAX_N][4]; dp[0][0] = 1;
    
    for (int i = 0; i < n; i++) {
        if (s[i] == '?') {
            for (int j = 0; j < 4; j++) dp[i+1][j] = (dp[i][j] * 3);
            for (int j = 0; j < 3; j++) dp[i+1][j+1] += dp[i][j];
        } else {
            for (int j = 0; j < 4; j++) dp[i+1][j] = dp[i][j];
            int k = s[i] - 'A';
            dp[i+1][k+1] += dp[i][k];
        }
    }
    
    cout << dp[n][ABC] << endl;
    return 0;
}

Measured memory_bytes: 2048
import java.io.*;
class Main {
    public static void main( String[] args ) throws IOException {
        BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );
        String line = br.readLine();
        String[] p = line.split( " " );
        int p1 = Integer.parseInt( p[ 0 ] );
        int p2 = Integer.parseInt( p[ 1 ] );
        String ans = "";
        if( p1 < p2 ) {
            ans = "a < b";
        } else if( p1 > p2 ) {
            ans = "a > b";
        } else {
            ans = "a == b";
        }
        System.out.println( ans );
    }
}

        

Measured memory_bytes: 24344
import java.util.Scanner;

public class Main {
    static void checkArray(int[] a){
        int i ;
        for( i = 0; i < a.length -1; i++){
                System.out.print(a[i] +" ");
        }
        System.out.print(a[i]);
        System.out.println();
    }
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        
        int[] arr = new int[N];
        for(int i = 0; i < N; i++) {
            arr[i] = sc.nextInt();
        }
        
        checkArray(arr);
        
        for(int i = 1; i <= N-1; i++) {
            int v = arr[i];
            int j = i - 1;
            while(j >= 0 && arr[j] > v ) {
                arr[j+1] = arr[j];
                j--;
            }
            arr[j+1] = v;
            checkArray(arr);
        }   
    }   
}

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

int findsum(int n) {
  int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main() {
  int n, a, b;
  int count = 0;
  cin >> n >> a >> b;
  for (int i = 1; i <= n; i++) {
    int sum = findsum(i);
    if (sum <= b && sum >= a) count += i;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
import std.stdio;
import std.algorithm;
import std.conv;
import std.array;
import std.string;
import std.math;
import std.functional;
import std.range;
import std.typecons;
import std.format;

void main(string[] args) {
  readln.solve.writeln;
}

auto solve(string line1) {
  auto _ = line1.chomp.split.map!(to!int).array;
  int a = _[0];
  int b = _[1];
  int c = _[2];
  int d = _[3];
  if (a + b > c + d) {
    return "Left";
  } else if (a + b < c + d) {
    return "Right";
  } else {
    return "Balanced";
  }
}

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

char a[N];
int n,num,x,y,modx[N],mody[N],ans[N],pre[N],suf[N];


int calc(int x){//把x除到0需要的步数 
	int res=0;
	while(x){
		res++;
		int tot=0;
		for(int i=0;(1<<i)<=x;i++)
			tot+=(x>>i & 1);
		x%=tot;
	} 
	return res;
}

int main(){
	cin>>n;
	cin>>(a+1);
	
	for(int i=1;i<=n;i++)
		if(a[i]=='1')num++;
	if(num==0){//没有1的时候 
		for(int i=1;i<=n;i++)cout<<1<<'\n';
		return 0;
	}
	if(num==1){//只有一个1的时候 
		if(a[n]=='1')
			for(int i=1;i<=n;i++)ans[i]=(i==n?0:2); 
		else 
			for(int i=1;i<=n;i++){
				if(a[i]=='1')ans[i]=0;
				else if(i==n)ans[i]=2;
				else ans[i]=1;
			}
		for(int i=1;i<=n;i++)cout<<ans[i]<<'\n';
		return 0;
	}	
		
	
	x=num+1;y=num-1;//y>=1
	// 先把操作一次得到的结果求出来
	 
	long long base=1;
	for(int i=n;i>=1;i--){
		base%=x;
		modx[i]=base;
		base*=2;
	}
	for(int i=1;i<=n;i++){
		if(a[i]=='1')pre[i]=modx[i]+pre[i-1];
		else pre[i]=pre[i-1];
		pre[i]%=x;
	}
	for(int i=n;i>=1;i--){
		if(a[i]=='1')suf[i]=modx[i]+suf[i+1];
		else suf[i]=suf[i+1];
		suf[i]%=x;
	}
	for(int i=1;i<=n;i++)if(a[i]=='0'){
		ans[i]=pre[i-1]+suf[i+1]+modx[i];
		ans[i]%=x;
	}
	
	base=1;
	for(int i=n;i>=1;i--){
		base%=y;
		mody[i]=base;
		base*=2;
	}
	for(int i=1;i<=n;i++){
		if(a[i]=='1')pre[i]=mody[i]+pre[i-1];
		else pre[i]=pre[i-1];
		pre[i]%=y;
	}
	for(int i=n;i>=1;i--){
		if(a[i]=='1')suf[i]=mody[i]+suf[i+1];
		else suf[i]=suf[i+1];
		suf[i]%=y;
	}
	for(int i=1;i<=n;i++)if(a[i]=='1'){
		ans[i]=pre[i-1]+suf[i+1];
		ans[i]%=y;
	}
	 
	for(int i=1;i<=n;i++)
		cout<<calc(ans[i])+1<<'\n';
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
    int k, a, b;
    cin >> k >> a >> b;
    for (int i = k; i <= b; i += k) {
        if (a <= i && b >= i) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3624
fn gcd(x: usize, y: usize) -> usize {
    let mut x = x;
    let mut y = y;
    while y != 0 {
        let t = y;
        y = x % y;
        x = t;
    }
    x
}

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let n: usize = buf.trim().parse().unwrap();

    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let a_s = buf.split_whitespace()
        .map(|x| x.parse::<usize>().unwrap())
        .collect::<Vec<_>>();

    let mut gcd_ls: Vec<usize> = vec![0usize; n];
    gcd_ls[0] = a_s[0];
    for i in 1..n {
        gcd_ls[i] = gcd(gcd_ls[i-1], a_s[i]);
    }

    let mut gcd_rs: Vec<usize> = vec![0usize; n];
    gcd_rs[n-1] = a_s[n-1];
    for i in (0..n-1).rev() {
        gcd_rs[i] = gcd(gcd_rs[i+1], a_s[i]);
    }

    /*
    for i in 0..n {
        println!("{}: {} {}", i, gcd_ls[i], gcd_rs[i]);
    }
    */

    let mut ans: usize = 0;
    for skip in 0..n {
        let gcd_t = if skip == 0 {
            gcd_rs[1]
        }
        else if skip == n-1 {
            gcd_ls[n-2]
        }
        else {
            let gcd_l = gcd_ls[skip-1];
            let gcd_r = gcd_rs[skip+1];
            gcd(gcd_l, gcd_r)
        };

        ans = std::cmp::max(ans, gcd_t);
    }

    println!("{}", ans);
}

Measured memory_bytes: 10492
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <utility>

using namespace std;

const int N = 300;
int n = 0;
int a[N][N],b[N][N],c[N][N];

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];
			b[i][j] = 1;
			c[i][j] = a[i][j];
		}
	}
	for(int k = 0; k < n; k++) {
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < n; j++) {
				c[i][j] = min(c[i][j],c[i][k] + c[k][j]);
			}
		}
	}
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++) {
			if(a[i][j] != c[i][j]) {
				cout << -1 << endl;
				return 0;
			}
		}
	}
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++) if(i!=j) {
			for(int k = 0; k < n; k++) if(i!=k && j!=k) {
				if(a[i][j] == a[i][k] + a[k][j]) b[i][j] = 0;
			}
		}
	}
	long long res = 0;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < n; j++) {
			res += b[i][j] * a[i][j];
		}
	}
	cout << res/2 << endl;
	return 0;
}




Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define inar ll ar[n];for(ll i=0;i<n;i++) cin>>ar[i];
#define loop for(ll i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(NULL);
  #define endl "\n"
  #define inf ll(1e19)
  #define mod int(1000000007)
 typedef long long int ll;
using namespace std;
int main()
{
	
	int n;
	cin>>n;
	cout<<n/2+(n%2);
}
	
	
	
	
	
	



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

int main() {
    array<int, 10> ar;
    for (auto& e : ar) {
        cin >> e;
    }
    sort(ar.begin(), ar.end(), greater<int>());
    for (int i = 0; i < 3; i++) {
        cout << ar[i] << endl;
    }
    return 0;
}

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

int main()
{
	int a, b, c;
	cin>>a>>b>>c;
	
	for (int i=0; i<10000000; i++) {
		int t = ((a+b)*i) / 60;
		if ((a+b)*i <= c+60*t && c+60*t <= b*i + a*(i+1)) {
			cout << c + 60*t << endl;
			return 0;
		}
	}
	cout << -1 << endl;
}

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

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int h, w;
    cin >> h >> w;
    vector<string> field(h);
    for (int i = 0; i < h; ++i)
    {
        cin >> field[i];
    }
    vector<int> count_I(w), count_O(h);
    long long ans = 0;
    for (int i = h - 1; i >= 0; --i)
    {
        for (int j = w - 1; j >= 0; --j)
        {
            if (field[i][j] == 'J')
            {
                ans += count_I[j] * count_O[i];
            }
            else if (field[i][j] == 'O')
            {
                ++count_O[i];
            }
            else
            {
                ++count_I[j];
            }
        }
    }
    cout << ans << '\n';
    return 0;
}


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

int main()
{
  int n,m,sum,i,j;
  string s;
  int a;
  map< int,string,greater<int> > prize;
  map<int,string>::iterator it;
  vector<string> v;
  bool flag;
  while(cin>>n>>m,n|m){
    prize.clear();
    v.resize(m);
    for(i=0;i<n;i++){
      cin>>s>>a;
      prize[a]=s;
    }
    for(i=0;i<m;i++){
      cin>>s;
      v[i]=s;
    }
    sum=0;
    for(i=0;i<m;i++){
      for(it=prize.begin();it!=prize.end();it++){
	flag=true;
	for(j=0;j<8;j++){
	  if('*'==it->second[j])continue;
	  if(v[i][j]==it->second[j])continue;
	  flag=false;
	}
	if(flag){
	  sum+=it->first;
	  break;
	}
      }
    }
    cout<<sum<<endl;
  }
}

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

int main() {
    int a, b;
    cin >> a >> b;
    bool ans = true;
    for(double i = 0; i < 1300; i++) {
        int x = i*0.08 / 1;
        int y = i*0.1 / 1;
        if(x == a && y == b) {
            ans = false;
            cout << i << endl;
            break;
        }
    }
    if(ans) cout << -1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int n;

signed main() {
	cin >> n;
	cout << n*(n+1)/2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e10;
const ll MAX_N = 1010;

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

ll dp[1010][1010];
ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
char a[1010][1010];
ll h, w;

//long longしか使わない
//素数は1より大きい
int main() {
	cin >> h >> w;
	dp[0][0] = 1;
	rep(i, h) {
		rep(j, w) {
			cin >> a[j][i];
			if (a[j][i] == '#')continue;
			if (j > 0) {
				if (a[j - 1][i] == '.')dp[j][i] += dp[j - 1][i];
				dp[j][i] %= MOD;
			}
			if (i > 0) {
				if (a[j][i - 1] == '.')dp[j][i] += dp[j][i - 1];
				dp[j][i] %= MOD;
			}
		}
	}
	cout << dp[w - 1][h - 1] << endl;
	return 0;
}



Measured memory_bytes: 12388
#include<cstdio>
int n,p[100001],b[100001];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&p[i]);
		b[p[i]]+=i;
		printf("%d ",30000*i);
	}puts("");
	for(int i=1;i<=n;i++){
		b[i]+=30000*(n-i+1);
	}
	for(int i=1;i<=n;i++){
		printf("%d ",b[i]);
	}
	return 0;
}

Measured memory_bytes: 768
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
//#define int long long
#define ll long long
#define P pair<int,int>
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define all(V) V.begin(),V.end()
#ifdef int
constexpr int INF = LLONG_MAX / 10;
#else
constexpr int INF = INT_MAX / 10;
#endif
constexpr double eps = 1e-9;
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
using namespace std;
inline ll gcd(ll a, ll b) {
	while (b) {
		ll c = a;
		a = b; b = c % b;
	}
	return a;
}
inline ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
bool isprime(ll n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
ll mypow(ll a, ll b) {
	if (!b)return 1;
	if (b & 1)return mypow(a, b - 1) * a;
	ll memo = mypow(a, b >> 1);
	return memo * memo;
}
int n, x, y;
vector<int> vec[2010];
int dist[2010], ans[2010];
signed main() {
	cin >> n >> x >> y;
	REP(i, n - 1) {
		vec[i].push_back(i + 1);
		vec[i + 1].push_back(i);
	}
	vec[x].push_back(y);
	vec[y].push_back(x);
	REP(i, n) {
		queue<int> que;
		fill(dist + 1, dist + n + 1, -1);
		que.push(i);
		dist[i] = 0;
		while (!que.empty()) {
			int node = que.front();
			que.pop();
			for (int i : vec[node]) {
				if (dist[i] == -1) {
					dist[i] = dist[node] + 1;
					que.push(i);
				}
			}
		}
		REP(j, n)ans[dist[j]]++;
	}
	REP(i, n - 1)cout << ans[i] / 2 << endl;
	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#define N 102
int M[N][N];
int ki[N],o;

void q(int t){
  int Q[1000];
  int head=0,tail=0;
  int i;
  Q[tail]=t;
  ++tail; 
  while(1){
    if(head==tail) break;
    
    t=Q[head];
    ++head;
    for(i=1;i<=o;i++){
      if(M[t][i]==1){
	if(ki[i]>=0)continue;
	Q[tail]=i;
	++tail;
	ki[i]=ki[t]+1;
      }
    }
  }
}

int main(){
  int i,j,k,u,M2;

  scanf("%d",&o);
  for(i=0;i<o;i++){
    for(j=0;j<o;j++){
      M[i][j]=0;
    }
  }
  
  for(i=0;i<o;i++){
    scanf("%d%d",&u,&k);
    ki[u]=-1;
    for(j=0;j<k;j++){
      scanf("%d",&M2);
      M[u][M2]=1;
    }
  }
  
  ki[1]=0;
  q(1);
  for(i=1;i<=o;i++){
    printf("%d %d\n",i,ki[i]);
  }
  return 0;
}




Measured memory_bytes: 2052
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf = 1e12;


int main(){
    while(1){
	int n,m;
	cin>>n>>m;
	if(n==0)break;
	//ll gs[n][n]={inf},gl[n][n]={inf};
	vector<vector<ll> > gs(n,vector<ll>(n,inf) ),gl;
	gl = gs;
	ll x[m],y[m],t[m];
	char state[m];
	for(int i=0;i<n;i++) gs[i][i] = gl[i][i] = 0;
	for(int i=0;i<m;i++){
	    cin>>x[i]>>y[i]>>t[i]>>state[i];
	    x[i]--,y[i]--;
	    if(state[i]=='S'){
		gs[x[i]][y[i]] = min(gs[x[i]][y[i]],t[i]);
		gs[y[i]][x[i]] = min(gs[y[i]][x[i]],t[i]);
	    }else{
		gl[x[i]][y[i]] = min(gl[x[i]][y[i]],t[i]);
		gl[y[i]][x[i]] = min(gl[y[i]][x[i]],t[i]);
	    }
	}

	for(int k=0;k<n;k++){
	    for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
		    gs[i][j] = min(gs[i][j],gs[i][k] + gs[k][j]);
		    gl[i][j] = min(gl[i][j],gl[i][k] + gl[k][j]);
		}
	    }
	}
	int r;
	cin>>r;
	ll z[r];
	for(int i=0;i<r;i++) cin>>z[i],z[i]--;
	//ll dp[r][n] = { inf };
	vector<vector<ll> > dp(r,vector<ll>(n,inf) );
	dp[0][z[0]] = 0;
	for(int i=0;i<r-1;i++){
	    for(int j=0;j< n;j++){
		dp[i+1][j] = min(dp[i+1][j],dp[i][j] + gl[ z[i] ][ z[i+1] ] );
		for(int k=0;k<n;k++){
		    dp[i+1][j] = min(dp[i+1][j],dp[i][k] + gl[z[i]][k] + gs[k][j] + gl[j][z[i+1]] ); 
		}
	    }
	}
	/*for(int i=0;i<r;i++){
	    for(int j = 0;j<n;j++) cout<<dp[i][j]<<' ';
	    cout<<endl;
	}*/

	ll res = inf;
	for(int i=0;i<n;i++) res = min(res,dp[r-1][i] );
	cout<<res<<endl;
    }

    return 0;
}



Measured memory_bytes: 5360
#include<iostream>
using namespace std;
int main()
{
    char arr[100][100];
    int r,c;
    int count1=0,count2=0;
    cin>>r>>c;
    for(int i=0 ; i<r ; i++){
        for(int j=0 ; j<c ; j++){
            cin>>arr[i][j];
        }
    }
    for(int i=0 ; i<r ; i++){
            if(arr[i][0] == '.'){
                for(int j=1 ; j<c ; j++){
                    if(arr[i][j] == '.'){
                        count1++;
                    }
                }
                if(count1 == c-1){
                    arr[i][0] = 'a';
                    for(int j=1 ; j<c ; j++){
                    arr[i][j] = 'a';
                }
                }
           }
           count1 = 0;
    }
    for(int i=0 ; i<c ; i++){
            if(arr[0][i] == '.' ||arr[0][i] == 'a'){
                for(int j=1 ; j<r ; j++){
                    if(arr[j][i] == '.' || arr[j][i] == 'a'){
                        count2++;
                    }
                }
                if(count2 == r-1){
                    arr[0][i] = 'a';
                    for(int j=1 ; j<r ; j++){
                    arr[j][i] = 'a';
                }
                }
           }
           count2 = 0;
    }
    int c3=0;
    for(int i=0 ; i<r ; i++){
        for(int j=0 ; j<c ; j++){
                if(arr[i][j] == 'a'){
                    c3++;
                }
                if(arr[i][j]!= 'a'){
                cout<<arr[i][j];
                }
        }
        if(c3 == c){
            c3 = 0;
        }
        else if(i < r-1){
            cout<<endl;
            c3 = 0;
        }
    }
    return 0;
}


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

int main() {
    int k;
    cin >> k;
    int ans = -1;
    int sev = 7;
    for (int i=0; i<k; i++) {
        if (sev % k == 0) {
            ans = i + 1;
            break;
        }
        sev = (sev % k) * 10 + 7;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3612